Yii中使用datepicker的几种方式
作者:zccst
一,前端展示
例1,最简单好用的方式。简单在于不需要$model
<div class="row"><?php echo $form->labelEx($model,'time'); ?><?php $this->widget('zii.widgets.jui.CJuiDatePicker', array('model'=>$model,'attribute'=>'time','options'=>array( //'showAnim'=>'slideDown', // 'show' (the default), 'slideDown', 'fadeIn', 'fold' 'showOn'=>'button', // 'focus', 'button', 'both' 'buttonImage'=>Yii::app()->request->baseUrl.'/images/calendar.png', 'buttonImageOnly'=>true, 'htmlOptions'=>array('readonly'=>"readonly"), 'changeMonth'=>true, 'changeYear'=>true, 'mode'=>'datetime', 'dateFormat'=>'dd/mm/yy','htmlOptions'=>array( 'size'=>43, 'value'=>(!empty($model->time))?(is_numeric($model->time))?date('d/m/Y',$model->time):$model->time:date('d/m/Y')),)));?><?php echo $form->error($model,'time'); ?></div>