Re: [QF] Patch to Fix addRule to Group

From: Date: Tue, 22 Jun 2004 21:10:38 +0000
Subject: Re: [QF] Patch to Fix addRule to Group
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-31129@lists.php.net to get a copy of this message
Mark Drago wrote: >Hey, > >I ran into a problem earlier today when I was trying to add a rule to a >group that represented an IP address. Adding the rule with addRule() >wasn't correctly checking each of the four text boxes in the group, and >adding the rule with addGroupRule() would generate 4 errors in the case >that all the text boxes were left blank. I posted my concerns to the >general PEAR list: > >̾/ > �ÙÚ¦Ud*.-http://marc.theaimsgroup.com/?l=pear-general&m=108791609403169&w=2 > >I offered to supply a patch for the problem so that when a rule is added >to a group, the rule is checked against all of the members of the >group. That patch is attached to this email. Basically, it checks to >see if the element that the rule is being applied to is a group, and if >it is, places the necessary javascript inside of a loop and checks each >member of the group. If there are any questions about the patch, don't >hesitate to ask. I apologize for 2 things: 1. I should write the documentation for rules, but unfortunately I am too busy for that at the moment. (Anyone interested ?) 2. When I said "did you try with addGroupRule() ?", I should have said "Try with addGroupRule() !". $form = new HTML_QuickForm('myform'); $el[] =& HTML_QuickForm::createElement('text', 'ip1', null); $el[] =& HTML_QuickForm::createElement('text', 'ip2', null); $el[] =& HTML_QuickForm::createElement('text', 'ip3', null); $el[] =& HTML_QuickForm::createElement('text', 'ip4', null); $form->addGroup($el, 'ipgroup', 'IP:'); $form->addElement('submit', 'submit', 'submit'); $form->addGroupRule('ipgroup', 'IP is required', 'required', null, 0, 'client'); This works AFAIK. Please confirm. Still, thanks for the patch, I don't think we will need it ;) Bertrand Mansion Mamasam

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