RE: HTML/QuickForm: Setting rules for Groupelements

From: Date: Tue, 04 Jun 2002 13:51:31 +0000
Subject: RE: HTML/QuickForm: Setting rules for Groupelements
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-1581@lists.php.net to get a copy of this message
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 ? Thanks, B. Stefansson

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