Friday, February 21, 2014

Yii - Display DatetimePicker option in form


<?php Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
                    $this->widget('CJuiDateTimePicker',array(
                        'model'=>$model, //Model object
                        'attribute'=>'date_of_join', //attribute name
                        'mode'=>'datetime', //use "time","date" or "datetime" (default)
                        'language' => '',
                        'options'=>array() // jquery plugin options
                    ));
                ?>
first of all download "CJuiDateTimePicker" extension and extract files
in the protected/extensions/ directory.
after that put above codes in your _form.php file.
if you want to show only date you can change the mode as "date" instead of "datetime".

No comments:

Post a Comment