In case someone stumbles upon this, an even more elegant solution would be to ditch the controller code and use one line in your view:
<? echo $form->input('movie_years', array('type' => 'date', 'dateFormat' => 'Y', 'minYear' => '1930', 'maxYear' => date('Y'))); ?> Much better! --Mark On Dec 22 2008, 8:19 pm, markfm <m...@p-m-w.com> wrote: > Never used $form->year before. Maybe somebody else can come up with a > fix for you. > > However, here's how I would skin this cat... > > In your controller, put in this code: > > $yearsToDisplay = range('1930', date('Y')); > $movieYears = array_combine($yearsToDisplay, $yearsToDisplay); > $this->set('movieYears', $movieYears); > > Then in your view: > > <?php echo $form->input('movie_year', array('type' => 'select', > 'options' => $movieYears)); ?> > > Take care, > Mark --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---