In the following way, you can add jQuery UI datepicker to your Yii site.
$this->widget('zii.widgets.jui.CJuiDatePicker',array(
'name'=>'publishDate',
// additional javascript options for the date picker plugin
'options'=>array(
'showAnim'=>'fold',
),
'htmlOptions'=>array(
'style'=>'height:20px;'
),
));
You can even add date picker to more than one elements.
For example, you have two date fields with ids:
joining_date and increment_date
Then you can add these two dates in array like:
$dateFields = array('joining_date', 'increment_date');
if (! empty($dateFields)) {
// See here, you can add run time fields.
$dateFieldIds = implode(',#', $dateFields);
$this->widget('zii.widgets.jui.CJuiDatePicker',array(
'name' => $dateFieldIds,
'options'=>array('showAnim'=>'fold',),
'htmlOptions'=>array('style'=>'height:20px; display:none;'),
));
}
Reference:
http://www.yiiframework.com/doc/api/1.1/CJuiDatePicker
$this->widget('zii.widgets.jui.CJuiDatePicker',array(
'name'=>'publishDate',
// additional javascript options for the date picker plugin
'options'=>array(
'showAnim'=>'fold',
),
'htmlOptions'=>array(
'style'=>'height:20px;'
),
));
You can even add date picker to more than one elements.
For example, you have two date fields with ids:
joining_date and increment_date
Then you can add these two dates in array like:
$dateFields = array('joining_date', 'increment_date');
if (! empty($dateFields)) {
// See here, you can add run time fields.
$dateFieldIds = implode(',#', $dateFields);
$this->widget('zii.widgets.jui.CJuiDatePicker',array(
'name' => $dateFieldIds,
'options'=>array('showAnim'=>'fold',),
'htmlOptions'=>array('style'=>'height:20px; display:none;'),
));
}
Reference:
http://www.yiiframework.com/doc/api/1.1/CJuiDatePicker
No comments:
Post a Comment