Hi,
I want to create an event section of my project and for this, I need to set start date and end date.
I have the code as
<div class="row">
<?php echo $form->labelEx($model,'start_date'); ?>
<?php Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
$this->widget('CJuiDateTimePicker',array(
'model'=>$model, //Model object
'attribute'=>'start_date', //attribute name
'mode'=>'datetime',
'options'=>array(
'minDate'=>0,
'maxDate'=>30,
'dateFormat'=>'yy:mm:dd',
'timeFormat'=>'hh:mm:ss'
), // jquery plugin options
'language' => ''
));
?>
<?php echo $form->error($model,'start_date'); ?>
</div>
<script language="javascript">
function enableEndDate(){
var start_date = $('#<?php echo Chtml::activeId($model,'start_date'); ?>');
var end_date = $('#<?php echo Chtml::activeId($model,'end_date'); ?>');
end_date.datetimepicker('minDate', (new Date()) );
}
</script>
<div class="row">
<?php echo $form->labelEx($model,'end_date'); ?>
<?php Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
$this->widget('CJuiDateTimePicker',array(
'model'=>$model, //Model object
'attribute'=>'end_date', //attribute name
'mode'=>'datetime',
'options'=>array(
'minDate'=>0,
'maxDate'=>30,
'dateFormat'=>'yy:mm:dd',
'timeFormat'=>'hh:mm:ss'
), // jquery plugin options
'language' => ''
));
?>
<?php echo $form->error($model,'end_date'); ?>
</div>
What I want is that the end date should be set only when the start date is set. I know the callback functions of data picker but unable to know where to call them in Yii widget
Any help?