Wednesday, December 26, 2012

Setting year range of Date drop down in CakePHP 1.3

Setting range of year in Date drop down in CakePHP.

There may be situations where you need to change the default values displayed in the year dropdown of Date field. Use minYear, maxYear for specifying the range. 

echo $this->Form->input('dob', array('minYear' => '1950','maxYear' => date('Y')-15)); 

In the above example 'dob' is the field name.

No comments:

Post a Comment