Re: multiple HTML_Quick FORM not validating and posting
| From: | Atif Khan | Date: | Mon, 20 Mar 2006 16:54:30 +0000 |
| Subject: | Re: multiple HTML_Quick FORM not validating and posting | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-23355@lists.php.net to get a copy of this message | ||
Iwas trying to avoid html_quickForm_controller, since I am only using
two forms. I guess, there is no way around it but to pass forms to another
using sessions.
Thanks
Atif
arnaud sellenet bodin wrote:
The problem with your code is that once the first form is submitted and validates, the second form displays. Then when the second form is submitted, the first form is not submitted anymore, so does not validate, so neither the second one. You should have a look at HTML_QuickFrom_Controller it's built to handle forms that spread on several pages. Le 20 mars 06 à 17:18, Atif Khan a écrit :Here is the code After submitting values form form1, I display form2, but form two does not like validating form2, it goes back to form1. <?php // Load the QuickForm code require "HTML/QuickForm.php"; $form1 = new HTML_QuickForm("form1", 'GET', null, null, null, true); $form1->addElement("text","entered_text","Enter some text"); $form1->addRule("entered_text","You must enter text","required"); $form1->addElement("submit","submit","Submit"); 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()){--PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpheader("Location: http://www.yahoo.com");} }else $form1->display(); ?>--PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php