Re: QF: client-side group rule
| From: | Bertrand Mansion | Date: | Tue, 22 Jun 2004 15:02:01 +0000 |
| Subject: | Re: QF: client-side group rule | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-13245@lists.php.net to get a copy of this message | ||
Mark Drago wrote:
>I am using the following code to do so:
>
>#create 4 text boxes for ip address
>$ip1 = &$this->createElement("text","text1",null,null);
>$ip2 = &$this->createElement("text","text2",null,null);
>$ip3 = &$this->createElement("text","text3",null,null);
>$ip4 = &$this->createElement("text","text4",null,null);
>
>#add text boxes to group
>$this->addGroup(array($ip1, $ip2, $ip3, $ip4),"ip_address");
>
>#add required rule
>$msg = "Your IP Address was not entered correctly.";
>$this->addRule("ip_address",$msg,'required',null,'client');
>
>This generates the javascript, but it never enforces the rule. There
>appears to be an error in the javascript. Two stanzas of javascript are
>added when this rule is created. The first stanza finds the values for
>each of the text boxes and puts them into an array named 'value'. The
>next stanza merely checks if value=''. Value is never equal to ''
>because value is an array. I saved the page locally and changed the
>second stanza to loop over all of the values in the 'value' array and
>check each one and I get the correct behavior. Is this an error in QF
>or am I using it incorrectly? If it is an error in QF, I can likely
>supply a patch to fix it.
Did you try with addGroupRule ?
Bertrand Mansion
Mamasam