Monday, November 21, 2011

Setting year range of Date drop down in CakePHP

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. 


<?php 
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