err... never mind... doesn't help with decimals On Sat, Nov 28, 2009 at 1:35 PM, Dave <[email protected]> wrote:
> He can then add the "numeric" rule as well > > > On Fri, Nov 27, 2009 at 9:30 AM, r4zv4n <[email protected]> wrote: > >> 'range' still won't fit his purpose, as it will allow for non-integer >> values ;) >> >> On Nov 27, 8:54 am, jburns <[email protected]> wrote: >> > Ah - yes - good call. It was late...! >> > >> > I should have said 'rule' => array('range', -1, 24). >> > >> > I agree with you that the best way is to present a drop down list as >> > that precisely controls the available inputs. >> > >> > On Nov 27, 6:39 am, r4zv4n <[email protected]> wrote: >> > >> > > 'between' actually means that the data's length should be between >> > > those numbers (i.e. between 0 and 23 characters), so that won't work. >> > >> > > One easy solution would be to use 'inList', like this: 'rule' => array >> > > ('inList', array(0,1,2,3,......,23)) >> > >> > > I'm assuming that on the client side, you're actually using a drop- >> > > down, not letting him input the hour freely, right? (but, as always, >> > > it's good practice not to trust the user's input :P ) >> > >> > > On Nov 27, 12:44 am, jburns <[email protected]> wrote: >> > >> > > > I think you'd have to add two rules which, when combined, only >> accepts >> > > > the data you want. A custom rule should do it too - I'll have a go >> > > > tomorrow if this is still open. In the meantime, try this: >> > >> > > >http://book.cakephp.org/view/246/decimal >> > >> > > > ...but with a 0 for the number of decimal places. Don't know if >> that's >> > > > valid or not. >> > >> > > > On Nov 26, 10:33 pm, "[email protected]" >> > >> > > > <[email protected]> wrote: >> > > > > Kind of. But this also allows "0.01" >> > >> > > > > How would I allow only 0, 1 ...23 and NOT numbers like 0.01 >> > >> > > > > On Nov 26, 7:48 pm, jburns <[email protected]> wrote: >> > >> > > > > > array('rule' => array('between', 0, 23), >> > > > > > 'message' => 'Please enter a number between 0 and 23.') >> > >> > > > > > On Nov 26, 6:41 pm, "[email protected]" >> > >> > > > > > <[email protected]> wrote: >> > > > > > > I have an field which is an hour: >> > >> > > > > > > "hour" => array( >> > > > > > > "required" => true, >> > > > > > > "allowEmpty" => false, >> > > > > > > "rule" => "/^\d{1,2}+/", >> > > > > > > ), >> > >> > > > > > > but how do I also specify that the number MUST be between 0 >> and 23 ? >> >> Check out the new CakePHP Questions site http://cakeqs.org and help >> others with their CakePHP related questions. >> >> You received this message because you are subscribed to the Google Groups >> "CakePHP" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected]<cake-php%[email protected]>For >> more options, visit this group at >> http://groups.google.com/group/cake-php?hl=en >> > > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
