Re: QF: client-side group rule

From: Date: Tue, 22 Jun 2004 15:14:55 +0000
Subject: Re: QF: client-side group rule
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-13246@lists.php.net to get a copy of this message
On Tue, 2004-06-22 at 11:02, Bertrand Mansion wrote: > 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 ? > Correct me if I'm mistaken, but addGroupRule() would add separate rules for each text box. My end goal is to get one error message per IP address, not for each text box. So, there are four separate text boxes, and if all four of them are left blank I only want one error message to be reported, not four. However, if the user fills out 3 out of the 4 text boxes, I still want the same error to be displayed. --Mark. /////////////////////////////////////////////////////////////// // // // Mark Drago Phone: 631-434-6600 // // Associate Software Developer Email: mdrago@bascom.com // // BASCOM Global Internet Services, Inc. // // // ///////////////////////////////////////////////////////////////

« previous php.pear.general (#13246) next »