Please help me with CJuiDatePicker

Hi all. im new to yii. Im implementing CJuiDatePicker for the registration page and i’ve been trying to figure out how to set the range of the year that the user can choose from the dropdown in CJuiDatePicker. I’ve been trying to find the answer throughout the forum but no result yet.

when i use ‘yearRange’=>1982 the CJuiDatePickerwon’t work.

Please help. Thanks

Hi ,

try this out in your widget option, working fine with mine.


'options'=>array(

	'showAnim'=>'fold',         // appear style

	'dateFormat'=>'dd-mm-yy',   // date format

	'changeMonth'=>'true',

	'changeYear'=>'true',

	'yearRange'=>'1982',        // answer of your question

),

Thankx.

You need to use yearRange in the options array




$this->widget('zii.widgets.jui.CJuiDatePicker', array(

    'model'=>$model,

    'attribute'=>'attribute',

    'value'=>$model->attribute,

    // additional javascript options for the date picker plugin

    'options'=>array(

            'changeMonth'=>true,

            'changeYear'=>true,

            'showAnim'=>'fold',

            'showButtonPanel'=>true,

            'autoSize'=>true,

            'dateFormat'=>'yy-mm-dd',

            'defaultDate'=>$model->StartDate,

            'yearRange'=> '1910:2020',

    )

));



Hi. Im sorry for my late reply. Yes, i already put the yearRange inside the option.

Now the code looks like this :

<?php

    &#036;this-&gt;widget('application.extensions.timepicker.EJuiDateTimePicker',array(


        'model'=&gt;&#036;model,


        'attribute'=&gt;'member_birthday',


        'options'=&gt;array(


            'hourGrid' =&gt; 4,


            'hourMin' =&gt; 0,


            'hourMax' =&gt; 23,


            'dateFormat'=&gt;'yy-mm-dd',


            'showHour' =&gt; false,


            'showMinute' =&gt; false,


            'showTime' =&gt; false,


            'alwaysSetTime'=&gt;false,


            'changeMonth' =&gt; true,


            'changeYear' =&gt; true,


            'yearRange'=&gt; '1910:2020',


            ),


        ));


    ?&gt;

Instead of using ‘yearRange’ => ‘1910’ (which doesnt work for me) I use ‘yearRange’=> ‘1910:2020’ and it works. Thanks for the solution =)