Reputation: 8575
I have a CForm builder code in my action:
$form = new CForm(
'application.components.portlets.views._newClientForm',
$model
);
and array of input elements:
<?php
return array(
'elements'=>array(
'client_type'=>array(
'type'=>'radiolist',
'items'=>Client::getClientTypes()
),
'mainPersonName1'=>array(
'type'=>'text',
),
How can i render a CJuiDatePicker in my form ?
Upvotes: 1
Views: 2196
Reputation: 101
'dob'=>array(
'type'=>'zii.widgets.jui.CJuiDatePicker',
'options'=>array(
'showAnim'=>'fold',
'dateFormat'=>'yy-mm-dd',
),
),
Upvotes: 0
Reputation: 3185
In your view file:
<?php
$this->widget('zii.widgets.jui.CJuiDatePicker',array(
'name'=>'arbitraryName',
'model'=>$model,
'attribute'=>'nameOfFormAttribute',
'options'=>array(
'jqueryOption'=>'jqueryOptionValue',
),
),
);
?>
Obviously, you have to pass your $model
object into the view for this to work.
::UPDATE:: Using only Cform you would do it this way: http://www.yiiframework.com/forum/index.php?/topic/7016-using-zii-cjuidatepicker-in-a-cform/
Upvotes: 3