Re: Other ways to validate quickform server side
| From: | Dan Rossi | Date: | Wed, 15 Jun 2005 00:58:57 +0000 |
| Subject: | Re: Other ways to validate quickform server side | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-19624@lists.php.net to get a copy of this message | ||
On 15/06/2005, at 10:15 AM, Justin Patrin wrote:
Sorry, I must not be understanding your question. I suggest you use addFormRule on the form with a callback which checks for the user being unique. If the user is not unique return an error. This way the validate() call on the form will fail and you won't process it (assuming your code is set up right).I guess some code will help, i use the Aframe ajax method which is an OO implementation of Sajax. However it requires a callback method which has to reside inside the calling rule function, this is moving into Jscript land which I why I had ask how I could handle the server side validate on post but within a post method handler. $form->registerRule('checkuser', 'callback', 'checkUsername',$this); $form->addRule('username', 'Please choose another handle', 'checkuser',null,'client'); <script language="javascript" src="javascript/aframe/aframe_client.js"></script> <script language="javascript"> function checkUsername(handle) { data = aframe_compact_data('handle',handle); aframe_call_service('GET','Aframe_LiveUser_CheckHandle', 'aframe', returnUsername, data); function returnUsername(data) { alert(data); //return false; //if (data) return false; //return true; if (data) return 'Yes'; //this.handleExists = 'Yes'; } //if (returnUsername) alert('Yes'); //alert(check); //alert(this.handleExists); return false; //handleExists ? return false : return true; //return true; } </script>