calendar in form

Hi!

I would like to have a date field in a form, where i can choose the date by clicking a small calendar next to it.

I am using CactiveForm. I found several php realisations on the net. Is there one ready in the yii framework? I couldn’t find one so far.

Thanks for your reply!

i’m not sure if yiiframework contains a datepicker… but at least there existing extensions for it… best would be if you just search ;)

http://www.yiiframework.com/doc/api/1.1/CJuiDatePicker

Good example of using CJuiDatePicker in CActiveForm

http://www.hollowdevelopers.com/2011/01/09/cjuidatepicker-cactiveform-yii-framework/

Documentation of CJuiDatePicker @ http://jqueryui.com/demos/datepicker/

I ended up using jui’s EDatePicker. I copied the extension to my protected/extension folder, and it works like a charm. Here is my code:


 <?php $this->widget('application.extensions.jui.EDatePicker',

			array(

          'name'=>'expire_time',

          'attribute'=>'del_timestamp', // Model attribute filed which hold user input

          'model'=>$model,            // Model name

          'language'=>'en',

          'mode'=>'imagebutton',

          'theme'=>'cupertino',

          'value'=>date('d-m-Y'),

          'htmlOptions'=>array('size'=>10),

          'fontSize'=>'0.8em'

         )

      );?>

Thanks for the advice!