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

Request #7608 removeRules() function
Submitted: 2006-05-12 03:56 UTC
From: paul dot t dot hinze at gmail dot com Assigned:
Status: Wont fix Package: HTML_QuickForm (version CVS)
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2006-05-12 03:56 UTC] paul dot t dot hinze at gmail dot com (Paul Hinze)
Description: ------------ At this point there is no direct way to remove a rule from an element. The removeElement() function accepts a boolean removeRules which unsets all rules for the deleted element. I propose making this functionality public with a removeRules function that accepts an element name and clears all rules for it. While it would be better to have the ability to delete/edit individual rules, this is an easy way to make functionality that already exists more easily accessible. Currently, as suggested to me by Justin Patrin, this can be worked around by removing and inserting an element as shown in the test script. Below that, I've copied code from removeElement to create an admittedly uninformed implementation of this function, but the idea is there. Test script: --------------- // current workaround $form->insertElementBefore($form->removeElement('field', true), 'elementAfter'); // proposed function function &removeRules($elementName) { if (!isset($this->_elementIndex[$elementName])) { $error = PEAR::raiseError(null, QUICKFORM_NONEXIST_ELEMENT, null, E_USER_WARNING, "Element '$elementName' does not exist in HTML_QuickForm::removeElement()", 'HTML_QuickForm_Error', true); return $error; } unset($this->_rules[$elementName]); return; } Expected result: ---------------- Function should remove all rules associated with elementName.

Comments

 [2006-05-29 16:06 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2008-01-21 20:34 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!