HTML_QuickForm: form fields as array problem

From: Date: Tue, 24 Dec 2002 15:22:22 +0000
Subject: HTML_QuickForm: form fields as array problem
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-11830@lists.php.net to get a copy of this message
Hi, Defining elements like: $form->addElement('text', 'input[textbox]', 'normal tb:'); doesn't seem to work properly. $form->addElement('text', 'textbox', 'normal tb:'); however does work. Run the two examples below and only leave the *required field blank. Only in the 2nd example will the the script "remember" what the user put in the 2nd textbox. Am I doing something wrong or is this a bug? Thanks Jeroen <?php // #1 doesn't work require_once ("HTML/QuickForm.php"); $form = new HTML_QuickForm('frmTest', 'POST'); $form->addElement('text', 'input[req_textbox]', 'required tb:'); $form->addElement('text', 'input[textbox]', 'normal tb:'); $form->addElement('submit', 'isubTest', 'Test Submit'); // Adds some validation rules $form->addRule('input[req_textbox]', 'this is a required field', 'required'); // Tries to validate the form if ($form->validate()) { // Form is validated, then processes the data $form->freeze(); $form->process(); echo "\n<HR>\n"; } else { $form->display(); } ?> to <?php // #2 does work require_once ("HTML/QuickForm.php"); $form = new HTML_QuickForm('frmTest', 'POST'); $form->addElement('text', 'req_textbox', 'required tb:'); $form->addElement('text', 'textbox', 'normal tb:'); $form->addElement('submit', 'isubTest', 'Test Submit'); // Adds some validation rules $form->addRule('req_textbox', 'this is a required field', 'required'); // Tries to validate the form if ($form->validate()) { // Form is validated, then processes the data $form->freeze(); $form->process(); echo "\n<HR>\n"; } else { $form->display(); } ?>

« previous php.pear.dev (#11830) next »