Thanks for that response but that's not what i was looking for,what i
need is for the form to only display previous month up to the current
one.Am trying to not let users be able to enter a birthday that is not
greater than the current day or month

On Jun 23, 10:35 am, Jeremy Burns | Class Outfit
<jeremybu...@classoutfit.com> wrote:
> Do you mean in the form? If so, yes. For example, this code will give you a 
> date field (without time) where the year is the the range [this year -100] 
> and [this year -18]:
>
> $form->input(
>         'dob',
>         array(
>                 'type' => 'datetime',
>                 'empty' => true,
>                 'dateFormat' => 'MDY',
>                 'timeFormat' => '',
>                 'minYear' => (
>                         date('Y') - 100
>                 ),
>                 'maxYear' => (
>                         date('Y') - 18
>                 )
>         )
> )
>
> Jeremy Burns
> Class Outfit
>
> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> On 23 Jun 2010, at 08:14, jerry wrote:
>
> > Is there a way to limit months just like maxYear or minYear? this
> > would be a lot more easier.
>
> > On Jun 22, 2:28 pm, Jeremy Burns | Class Outfit
> > <jeremybu...@classoutfit.com> wrote:
> >> Sorry - just read the post properly and my answer wasn't your solution, 
> >> but it can be adapted. The key is to write a function and within that 
> >> compare $check['dob'] with today's date.
>
> >> Jeremy Burns
> >> Class Outfit
>
> >> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> >> On 22 Jun 2010, at 12:12, Jeremy Burns | Class Outfit wrote:
>
> >>> Add this to your model validation (assuming the field you are checking is 
> >>> called 'dob'):
>
> >>> 'dob' => array(
> >>>    'inRange' => array(
> >>>            'rule' => 'isAgeInAcceptedRange',
> >>>            'message' => 'You must be between the ages of 18 and 80.'
> >>>    )
> >>> ),
>
> >>> Then add this function to your model:
>
> >>> function isAgeInAcceptedRange($check) {
>
> >>>    list($Y,$m,$d) = explode("-", $check['dob']);
>
> >>>    $userAge = ( date("md") < $m.$d ? date("Y")-$Y-1 : date("Y")-$Y );
>
> >>>    if ( ($userAge >= 18) && ($userAge <= 80) ):
> >>>            return true;
> >>>    else:
> >>>            return false;
> >>>    endif;
>
> >>> }
>
> >>> Jeremy Burns
> >>> Class Outfit
>
> >>> jeremybu...@classoutfit.com
> >>>http://www.classoutfit.com
>
> >>> On 22 Jun 2010, at 10:16, jerry wrote:
>
> >>>> I have been using cakephp for a few weeks now but i have failed to
> >>>> know how to validate a date for example a birthday to make sure it's
> >>>> now greater than the current date.Could anyone point me to the right
> >>>> direction
>
> >>>> Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 cake-php@googlegroups.com
> >>>> To unsubscribe from this group, send email to
> >>>> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> >>>> athttp://groups.google.com/group/cake-php?hl=en
>
> >>> Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 cake-php@googlegroups.com
> >>> To unsubscribe from this group, send email to
> >>> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> >>> athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to