Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.2.14

Bug #15520 Element not removed form the $_required array on removeElement()
Submitted: 2009-01-06 01:26 UTC Modified: 2009-04-04 21:41 UTC
From: onokazu Assigned: avb
Status: Closed Package: HTML_QuickForm (version 3.2.10)
PHP Version: 4.4.9 OS: Mac OSX
Roadmaps: 3.2.11    
Subscription  


 [2009-01-06 01:26 UTC] onokazu (Kazumi Ono)
Description: ------------ A required element that has beeen removed by calling HTML_QuickForm::removeElement() has its name in the $_required array even after removal. Possible patch that could be added to the HTML_QuickForm::removeElement() method: if (false !== $required_key = array_search($elementName, $this- >_required)) { unset($this->_required[$required_key]); }

Comments

 [2009-01-15 09:44 UTC] doconnor (Daniel O'Connor)
Want to make us a quick test script? <?php require_once 'Form.php'; $form = new Form()); $form->addElement('bar', $required = true); $form->removeElement('bar'); assert(!isset($form->_required['bar']));
 [2009-04-04 15:58 UTC] avb (Alexey Borzov)
-Status: Open +Status: Verified -Assigned To: +Assigned To: avb
Here is a proper test script: ------------------------ require_once 'HTML/QuickForm.php'; $form = new HTML_QuickForm('bug15520'); $form->addElement('text', 'foo', 'Foo is required:'); $form->addRule('foo', 'required!', 'required'); $form->addElement('text', 'bar', 'Bar is not required:'); $form->removeElement('foo'); $form->display(); ------------------------ The "* denotes required field" not is displayed below form, even while the form does not contain any required elements.
 [2009-04-04 21:41 UTC] avb (Alexey Borzov)
-Status: Verified +Status: Closed
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.