Cjuidatepicker is used for date input, which encapsulates the JUI DatePicker plug-in, and its basic usage is as follows:
<?php echo $form->errorsummary ($model);?>
<?php
$this->widget (' Zii.widgets.jui.CJuiDatePicker ', Array (
' name ' => ' my_date ',
' language ' => ' en ',
' options ' => Array (
///' show ' (the default), ' Slidedown ', ' fadeIn ', ' fold '
showanim ' => ' fold ', ' Showon
' => ' Button ',//' Focus ', ' button ', ' both '
buttontext ' => ' Select form calendar ',
' buttonimage ' => ' images/ Calendar.png ',
' buttonimageonly ' =>true,
),
' Htmloptions ' =>array (
' style ' => ' width : 80px;vertical-align:top '
)
);
? >
<center class= "row Submit" >
<?php echo Chtml::submitbutton (' submit ');?>
</ center>
<?php $this->endwidget ();?>
</center><!--form-->
To get the date entered, first assign a value to the Cjuidatepicker Name property, in this case my_date, and then define Datamodel
Class
Datamodel extends Cformmodel
{public
$my _date;
}
When the user submits, displays the date entered by the user, modifies the Sitecontroller Actionindex
Public Function Actionindex ()
{
$model =new datamodel ();
if (!empty ($_post[' my_date '))
{
$model->my_date=$_post[' my_date '];
if ($model->validate ()) {
$this->render (' result ', array (
' model ' => $model,
));
return;
}
$this->render (' index ', array (
' model ' => $model
);
}
See a full set of tutorials: http://www.bianceng.cn/webkf/PHP/201301/35265.htm
This example downloads: Http://www.imobilebbs.com/download/yii/DatePickerDemo.zip