Re: RE: HTML/QuickForm: Setting rules for Groupelements

From: Date: Tue, 04 Jun 2002 14:11:53 +0000
Subject: Re: RE: HTML/QuickForm: Setting rules for Groupelements
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-1582@lists.php.net to get a copy of this message
le 4/06/02 15:51, Birgir Stefansson à bs@hi.is a écrit : > Hi, > I’m trying to build a ruleset for a form that collects > creditcardinformation and running into difficulties with setting rules > to the input boxes after grouping them together. > Class FormCC() { > ... > function FormCC () { > $this->HTML_QuickForm(); > $part1 = $this->createElement("text", "part1", null, > "maxlength=4 size=4 class=rammatafla"); > $part2 = $this->createElement("text", "part2", null, > "maxlength=4 size=4 class=rammatafla"); > $part3 = $this->createElement("text", "part3", null, > "maxlength=4 size=4 class=rammatafla"); > $part4 = $this->createElement("text", "part4", null, > "maxlength=4 size=4 class=rammatafla"); > $this->addElementGroup(array($part1, $part2, $part3, > $part4), 'CC:', 'kortanumer', '-'); > .. > $this->addElement($this->createElement("submit", "Send", > "Send")); > // Reglur fyrir formið > $this->addRule('kortanumer', 'cc must be filled out.', > 'required', '', 'client'); > $this->addRule('kortanumer', 'cc is numeric.', 'numeric', > '','client'); > $this->addRule('kortanumer', 'cc is 16 digits.', > 'maxlength', '16', 'client'); > $this->addRule('kortanumer', 'cc is 16 digits.', > 'minlength', '16', 'client'); > } > .. > } > > This for some reason doesn’t get tested clientside and i get errors even > though all the rules are satisfied. > Is there something different I have to do to be able to set rules for > groups or am I just missing out something ? Should I write my own > function and set that as a rule for the group ? > Can I find documentation on HTML/QuickForm somewhere ? You can't validate against groups in QuickForm. You are the second person who's asking for that. It might be implemented some day as I see it can be useful. For now, just make a single textfield of your group. Bertrand Mansion Mamasam

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