I am using CJuiDateTimePicker in my code. I want to keep a default value. Can anybody tell me how to do this?
my code is:
<?php Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
$this->widget('CJuiDateTimePicker',array(
'model'=>$model, //Model object
'attribute'=>'['.$i.']timein', //attribute name
'mode'=>'time', //use "time","date" or "datetime" (default)
'value'=>'08:00:00'////////////// this does not work
'options'=>array() // jquery plugin options
));
?>
Hope this will definitely help you.And please define a default formate in option array and then ty to assign a default value.Might be this will work for you.
Your suggestion helped but not fully. I can set defalut value by using the parameter hour, it reflects on the slider but i want the value to be shown in the text box. Is this possible?
As u can see i have set the hour to 8 which shows on the slider but it doesnt display in the text field. I need the time to be displayed in the text field without first selecting the time.
<?php Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
$this->widget('CJuiDateTimePicker',array(
'name'=>'define a model attribute here', // like Event[start_date]
'model'=>$model,
'value'=>"define a value here",
// 'attribute'=>'['.$i.']timein', //attribute name
'mode'=>'time', //use "time","date" or "datetime" (default)
'options'=>array('timeFormat'=>'hh:mm:ss','hour'=>'8'
) // jquery plugin options
));
?>
i have some problem regarding the CJuiDateTimePicker extension.
i would like to update an existing record. on the form, the textbox is filled with the current value of the model attribute: 2012-03-29 12:25:00
if i click on the textbox, the CJuiDateTimePicker opens, but not with the proper datetime. only the time part is correct, the selected date is the current (2012-04-24), not the proper value of the record (2012-03-29).
Same problem - the time part is set correctly, but the month stays on the current month (right now, that’s April 2012), rather than display the date contained in the model (eg May 2008).
I spent half a day trying to figure this out and finally found a solution. The JS files are out of date and have to be updated. I can’t post links as my account is too new (couldn’t post a comment in the extension page either, a very annoying way to prevent spam), so google “yii improving datetimepicker” for the solution at Hollow Developers, or go straight to Trent Richardson’s jQUery-Timepicker-Addon page at Github and download them from there.