php - CakePHP 2.x Troubles Using minYear/maxYear Params -
i use cakephp v. 2.3.4 on windows 7 32 bits, i'm trying use maxyear
, minyear
parameters, don't correct values, code use next:
echo $this->form->input( 'date_birth', array( 'dateformat'=>'dmy', 'minyear'=>date('y')-100, 'maxyear'=>date('y')-18 )
);
the values shown cake are: min year: 1913, max year: 2013.
correct values should be: min year: 1913, max year: 1995.
also tried put:
echo $this->form->input( 'date_birth', array( 'dateformat'=>'dmy', 'maxyear'=>date('y')-18 ) );
but result incorrect: from 1993 2013.
please me.
i found adding default value input corrects issue; essentially, cakephp default date entry current date, , looks if try set maxyear earlier default, ignores maxyear in favor of default.
so:
echo $this->form->input( 'dob', array( 'type' => 'date', 'selected' => array( 'year'=>date('y')-18 ), 'minyear' => date('y') - 100, 'maxyear' => date('y') - 18 ) );
Comments
Post a Comment