Re: php Addrule ( Numeric and decimal point)

From: Date: Sun, 02 May 2010 14:01:35 +0000
Subject: Re: php Addrule ( Numeric and decimal point)
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-30484@lists.php.net to get a copy of this message
Hi alexey, Thank you for your response! I just googled to find out more about the regex used in the 'numeric' function. Would it be possible for you to provide me with an example of a sample regex used ,so I can get inspired and create my own? Thank you kindly for your help! regards, zia On Sun, May 2, 2010 at 9:56 AM, Alexey Borzov <borz_off@cs.msu.su> wrote: > 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 (#30484) next »