CJuiDatePicker with active model attribute

I got the following:

<?php echo CHtml::activeLabelEx($model, 'date'); ?>

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











By default the form fields get populated with ‘class=“error”’ if there is an error in the field. But the DatePicker field is only populated with ‘class=“hasDatePicker”’.

Anyone able to advise?

Use ‘model’=>$model, ‘attribute’=>‘date’

Thank you! Why is this the only place that covers this?

Does anybody know how to do this with the Timepicker extension?


I tried adding in the ‘attribute’ property in to the array but it is not recognised.

Me too hv the same problem…

am using time picker in my project…

but am not able to specify ‘attribute’ property…

   $this->widget('ext.timepicker.TimePicker', array(









                'firstDay' => 1,







please help me to solve this…

Here is the solution:

In extensions/timepicker/TimePicker.php:

Replace var $name; with var $attribute;

Replace $this->uniq = $this->id.’_’.uniqid(); with $this->uniq = CHtml::activeId($this->model, $this->attribute);

public function run() should look like this:

public function run()


	$this->render('TimePicker', array('id'=>$this->uniq, 'model'=>$this->model, 'attribute'=>$this->attribute));		


In extensions/timepicker/views/TimePicker.php:

The content of this file should be:

<?php echo CHtml::activeTextField($model, $attribute, array('id'=>$id, 'class'=>'timepicker')); ?>

When inserting the widget on the page, remember to replace the ‘name’ element with ‘attribute’.