Re: Question Regarding HTML_QuickForm

From: Date: Wed, 24 Dec 2003 12:25:13 +0000
Subject: Re: Question Regarding HTML_QuickForm
References: 1 2 3 4  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-9816@lists.php.net to get a copy of this message
Hi! Sanjay wrote:
The point which I am not clear, what I need to do in my action.php, do I have to write if $_POST['MyTextBox'] is empty then this means required field was empty. If I have to do this then what is point in making server side rule ( $form->addRule('MyTextBox', 'Your name is required', 'required','','server'); If possible, can you give me some example so that I can understand more.
As I already said, you need to perform validation in the script to which you submit the form. That means that you must define the rules *in that file*. That also means you need to define the whole form in that file (or else how are you going to display it in case of the error?). That means that you'll have the same code in two files, that risks becoming inconsistent. And this is precisely the reason why all enclosed QF examples submit to the script where the form is defined, not to some other one, and why there is no hack-less way in QF_Controller to submit to some other script.

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