Re: php Addrule ( Numeric and decimal point)

From: Date: Sun, 02 May 2010 13:56:23 +0000
Subject: Re: php Addrule ( Numeric and decimal point)
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-30483@lists.php.net to get a copy of this message
Hi Zia, On 02.05.2010 13:03, zia mohaddes wrote:
I have a quick question regarding the form->addGroupRule. I am currently creating a field where it requires the user to enumer a number and the number must be a 1 decimal point ( i.e 1.2). I am using : $this->form->addGroupRule($field . "_group", array(array(array("Numbers only, please", 'numeric')))); but I am not sure how to add the 'decimal point' validation rule to the rule above. I highly appreciate any hints or feedback in this regard!
'numeric' rule is just the Regex rule with a predefined regular expression (BTW, it does allow numbers with decimal points). If you want to only allow one digit after a decimal point, you'll have to do your own regexp, probably taking the existing one as inspiration.

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