On Dec 21, 7:11 pm, Ldg27 <[EMAIL PROTECTED]> wrote:
> I need to create some datetime selects with the dateTime method from
> the form helper. I need the select's year to have only current year
> and next year.
> I do this by:
> $form->dateTime('Event.startime','DMY', 12, null,
> array('maxYear'=>date('Y', strtotime('next year')),
> 'minYear'=>date('Y')), false);
>
> This works for what I want but:
>
> -It creates maxYear and minYear attributes in the select tag:
>
> <select name="data[Event][startime_year]" maxyear="2008"
> minyear="2007" id="EventStartimeYear">
>
> -It selects next year (in this case: 2008), instead of current year as
> default.
>
> I would appreciate any help.

Hi,

if you pass showEmpty = false (your last parameter), maxYear = some
Year and selected = null than maxYear will be selected by default.

see:
cake/libs/view/helpers/form.php
line 1078 - 1088 (latest svn version)

so you could set your minYear also asthe select parameter.
although line 1083 means that strlen of the selected parameter should
be greater than 4. i think this should be "equal" or "equal or greater
than" 4.
or you pass false instead of null so that no selection is made.

i hope this helps you cause i only looked at the code and did not test
it right now. :-)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to