Yii Framework Forum: using the extension 'cjuidatetimepicker widget' - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

using the extension 'cjuidatetimepicker widget' Rate Topic: -----

#1 User is offline   ajit kumar 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 15-October 11

Posted 24 October 2011 - 05:52 AM

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:
1. 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 }
0

#2 User is offline   fsb 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 113
  • Joined: 09-January 11

Posted 01 November 2011 - 09:48 AM

Ajit, Did you find the answer to this question?
Join the happiest place on Freenode: #yii
We've got a MrFisk the bot, hilarious banter and all kinds of other groovy stuff going on.
Comparison of Internet Relay Chat clients
Web IRC client
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users