It's really not difficult :-)
And its a very powerful solution once you understand how it works.
On Sep 16, 1:46 am, Tony Thomas <truet...@gmail.com> wrote:
> Thanks. I was afraid that might be the case.
>
> On Sep 15, 7:42 pm, "Dardo Sordi Bogado" <dardoso...@gmail.com> wrote:
>
> > You can't use functions i.e date() at class definitions, create a
> > custom method in the model and use that as a validation rule.
>
> > On Mon, Sep 15, 2008 at 9:34 PM, Tony Thomas <truet...@gmail.com> wrote:
>
> > > According to the documentation that's the proper way to define the
> > > array.
>
> > >http://book.cakephp.org/view/139/comparison
>
> > > It just amounts to defining an array without defining the keys if I'm
> > > not mistaken. I'll take a closer look at the syntax in the morning
> > > when my mind is a little fresher. I'll post something here if
> > > something jumps out at me.
>
> > > On Sep 15, 4:20 pm, 703designs <thomasmal...@gmail.com> wrote:
> > >> I noticed that the way you coded your array would definitely throw a
> > >> syntax error.
>
> > >> How about
> > >> 'rule' => array(
> > >> 'comparison' => date()
> > >> ),
>
> > >> I'll try this on my Cake installation later to check, as I haven't
> > >> used the 'comparison' validator. I just know that your array looks
> > >> botched.
>
> > >> On Sep 15, 5:14 pm, 703designs <thomasmal...@gmail.com> wrote:
>
> > >> > date() should just return the formatted date string. What sort of
> > >> > errors are you seeing?
>
> > >> > On Sep 15, 3:51 pm, Tony Thomas <truet...@gmail.com> wrote:
>
> > >> > > Anyone have a proven method for validating submitted dates to make
> > >> > > sure they're not in the future?
>
> > >> > > The closest I can get is:
>
> > >> > > 'date_field' => array('rule' => array('comparison',
> > >> > > '>=',
> > >> > > date()),
> > >> > > 'message' => 'Dates cannot be in the future.')
>
> > >> > > But date() is throwing a syntax error.
>
> > >> > > None of the core time testing helpers do this.
>
> > >> > > I should note that in the controller, before save, the date string is
> > >> > > converted into a Unix timestamp.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment