Re: multiple HTML_Quick FORM not validating and posting
| From: | Mark Wiesemann | Date: | Mon, 20 Mar 2006 16:50:03 +0000 |
| Subject: | Re: multiple HTML_Quick FORM not validating and posting | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-23354@lists.php.net to get a copy of this message | ||
Atif Khan wrote:
> if ($form1->validate()){
> $form2 = new HTML_QuickForm("form2", 'GET', null, null, null, true);
> $form2->addElement('text', 'name', 'Enter name');
> $form2->addElement("submit",'submit2',"Submit2");
> $form2->addRule('name', 'You must enter name','required');
>
> $form2->display();
>
> if ($form2->validate()){
> header("Location: http://www.yahoo.com");
> }
This means that form1 needs to be valid before validating form2. That
won't work -- after submitting form2, information from form1 is lost and
thus form1 isn't valid anymore.
Just one possible solution: Store the validity of form1 in a session
variable and display (and validate) form2 only if this variable is true.
HTH,
Mark