GSTAR  
          
              
                February 26, 2010,  5:07pm
               
              1 
           
         
        
          I got the following:
<?php echo CHtml::activeLabelEx($model, 'date'); ?>
<?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(
	'name'=>'Event[date]',
	'value'=>$model->date,
	'options'=>array(
		'dateFormat'=>'dd/mm/yy',
		'showAnim'=>'slideDown',
		'showButtonPanel'=>'true',
		'constrainInput'=>'false',
		))
	);
?>
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?
         
        
           
         
            
       
      
        
          
          
            theKiller  
          
              
                February 27, 2010, 11:35pm
               
              2 
           
         
        
          Use ‘model’=>$model, ‘attribute’=>‘date’
         
        
           
         
            
       
      
        
        
          
Thank you!  Why is this the only place that covers this?
         
        
           
         
            
       
      
        
          
          
            GSTAR  
          
              
                July 22, 2010, 12:00pm
               
              4 
           
         
        
          Does anybody know how to do this with the Timepicker extension?
http://www.yiiframework.com/extension/timepicker/#doc 
I tried adding in the ‘attribute’ property in to the array but it is not recognised.
         
        
           
         
            
       
      
        
          
          
            viji  
          
              
                July 28, 2010, 11:20am
               
              5 
           
         
        
          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(
            'id'=>'datetime',
            'model'=>$model,
            'name'=>'DueDate',
            'options'=>array(
                'duration'=>'',
                'showTime'=>true,
                'time24h'=>false,
                'dateFormat'=>'dd-mm-yy',
                'firstDay' => 1,
                'stepMinutes'=>5,
                'showOn'=>'focus',
                'changeMonth'=>true,
                'changeYear'=>true,
            ),
        )); 
please help me to solve this…
         
        
           
         
            
       
      
        
          
          
            GSTAR  
          
              
                October 7, 2010,  8:29pm
               
              6 
           
         
        
          
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’.