Re: QF 3.2 - regex throwing errors

From: Date: Thu, 06 Nov 2003 07:01:04 +0000
Subject: Re: QF 3.2 - regex throwing errors
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-8803@lists.php.net to get a copy of this message
Hi! Mike Carter wrote:
Having attempted to switch to using addGroupRule() it seems to have caused more problems. The on-line manual exmaple is different from example7 in the archive. However I think I've implemented it the same... $postcode[] = &HTML_QuickForm::createElement('text', 'postcode', '', array('size' => '25', 'maxlength' => '10', 'tabindex' => 2)); $postcode[] = &HTML_QuickForm::createElement('static', 'help', '', $this->language['L_HelpPostcode'], $helpButton)); $this->addGroup($postcode, 'postcodeGroup', $this->language['L_YourPostcode']); // --- Form field rules $this->addGroupRule('postcodeGroup', array('postcode' => array( array($this->language['L_RequirePostcode'], 'required', null, 'client'), array($this->language['L_InvalidPostcode'], 'regex', '/[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}/', 'client') ))); Now the required field is not marked with an asteriks and no validation appears to be executed, client or server side.
This works as expected: $form->addGroupRule('postcodeGroup', 'Postcode is required', 'required', null, 1, 'client'); Though I agree, rules will not suffer from more and better documentation...

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