时间:2021-07-01 10:21:17 帮助过:4人阅读
<!--?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' ), )); ?> endWidget(); ?>
为了获取输入的日期,首先为CJuiDatePicker的Name属性赋值,本例为my_date,然后定义DataModel
class DataModel extends CFormModel { public $my_date; }
当用户提交时,显示用户输入的日期,修改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, )); }
以上就是PHP开发框架Yii Framework教程(36) Zii组件-DatePicker示例的内容,更多相关内容请关注PHP中文网(www.gxlcms.com)!