multiple QFs on the same page

From: Date: Tue, 07 Dec 2004 20:46:38 +0000
Subject: multiple QFs on the same page
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-16091@lists.php.net to get a copy of this message
I have 2 HTML_QuickForms on the same page. My problem is that when the submit button is pressed for one form, both forms are validated and the rules for both forms are applied as if both submit buttons were pressed at the same time even though I have 2 different form objects. I thought QuickForm only attempts to validate if the submit button for that form was pressed. Obviously, I'm wrong in that assumption. Or am I? // init search form object $form = new HTML_QuickForm('search'); $form_p = new HTML_QuickForm('properties'); // init form elements $form->addElement('text', 'keyword', NULL, array('size' => 20)); $form->addElement('submit','search','Search By Keyword', array('accesskey' => 'return')); $form_p->addElement('select', 'status', 'Status', $status_arr); $form_p->addElement('submit','update','Update Properties', array('accesskey' => 'return')); // validate data if ($form->validate()) { echo 'Search form valid'; } else if ($form_p->validate()) { echo 'Properties form valid'; } - Erik Heerlein

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