php - cakephp form helper for a date: how to make minYear and maxYear work -
i'm trying implement date selector in cake-1.3. problem i'm having i've not been able confine year selector desired set of years, 2012 through current year, whatever might be. i've tried 3 or 4 ways of coding this, based on own thoughts , on examples cakephp site, stack overflow, , @ to the lowest degree 1 other site. no matter approach take, years in selection list range 1994 2034.
here current version of code this:
echo "<div class='date'>" . $this->form->input('start_date', array('type'=>'date', 'default'=>array('month'=>$yesterday['month'], 'day'=>$yesterday['mday'], 'year' => $today['year'], array('dateformat' => 'mdy', 'minyear' => 2012, 'maxyear' => $yesterday['year'], selected) ) ) ) . "</div>";
any suggestions highly appreciated.
your input options should in single unnested array.
echo "<div class='date'>" . $this->form->input('start_date', array('type'=>'date', 'default'=>array('month'=>$yesterday['month'], 'day'=>$yesterday['mday'], 'year' => $today['year']), 'dateformat' => 'mdy', 'minyear' => 2012, 'maxyear' => $yesterday['year'] ) ) . "</div>";
php cakephp cakephp-1.3
No comments:
Post a Comment