Re: Other ways to validate quickform server side

From: Date: Wed, 15 Jun 2005 00:15:49 +0000
Subject: Re: Other ways to validate quickform server side
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-19623@lists.php.net to get a copy of this message
On 6/14/05, Dan Rossi <pear@electroteque.org> wrote: > Hi there, I have tried to post this before, there is functional > limitations in terms of validating quickform server side. My issue is I > need to register a custom rule which requires doing a lookup for > duplicate usernames in the database. I handle get and post requests in > different methods within the page class. This ideally means the way > quickform validates by posting to itself is virtually impossible in > this circumstance. I handle my get requests which executrs a class > method say _doGet and post method _doPost. Now if I post how would it > be possible to display the form again (I use DB_DataObject_Formbuilder > and a Flexy quickform renderer) if a server side validation rule check > has occured before actually allowing it to post ? Please let me know > its one last hurdle. > > Currently to prevent having to find a server side validation solution, > I am trying an ajax connection within the javascript rule function > however gettijng it to return true and false within the ajax callback > function is trikky right now. > 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). -- Justin Patrin

« previous php.pear.general (#19623) next »