Hi, I am new to Yii. I am trying to use and extension for the datetime field in my registration form.How do we use extension. For example, I am trying to use cjuidatetimepicker widget , but it gives error.
I did the following things:
- downloaded the extension files and put it in the protected/extensions/ folder.
2.then I replaced the date input field in my form with the following code:
<?php Yii::import(‘application.extensions.CJuiDateTimePicker.CJuiDateTimePicker’);
$this->widget('CJuiDateTimePicker',array(
'model'=>$news, //Model object
'attribute'=>'eventDate', //attribute name
'mode'=>'datetime', //use "time","date" or "datetime" (default)
'options'=>array() // jquery plugin options
));
?>
but it gives this error:
CException
CJuiDateTimePicker must specify "model" and "attribute" or "name" property values.
/home/ubc/Documents/yii/framework/zii/widgets/jui/CJuiInputWidget.php(54)
42 /**
43 * @return array the name and the ID of the input.
44 */
45 protected function resolveNameID()
46 {
47 if($this->name!==null)
48 $name=$this->name;
49 else if(isset($this->htmlOptions[‘name’]))
50 $name=$this->htmlOptions[‘name’];
51 else if($this->hasModel())
52 $name=CHtml::activeName($this->model,$this->attribute);
53 else
54 throw new CException(Yii::t(‘zii’,’{class} must specify “model” and “attribute” or “name” property values.’,array(’{class}’=>get_class($this))));
55
56 if(($id=$this->getId(false))===null)
57 {
58 if(isset($this->htmlOptions[‘id’]))
59 $id=$this->htmlOptions[‘id’];
60 else
61 $id=CHtml::getIdByName($name);
62 }
63
64 return array($name,$id);
65 }