Home >Backend Development >PHP Tutorial >How to use yii time control_PHP tutorial

How to use yii time control_PHP tutorial

WBOY
WBOYOriginal
2016-07-14 10:06:351001browse

Our forms often require users to input time. There is a very convenient time control CJuiDatePicker in Yii for use. The result is as follows:

How to use yii time control_PHP tutorial
Call method
[php]
$this->widget('zii.widgets.jui.CJuiDatePicker',array(
'language'=>'zh_cn',
            'name'=>'worktime[start]',
             'value'=>$query['start'] ? $query['start'] : Date('Y-m-d'),
            'options'=>array(
'showAnim'=>'fold',
'showOn'=>'both',
                    'buttonImage'=>Yii::app()->request->baseUrl.'/images/calendar.gif',
'maxDate'=>'new Date()',
‘buttonImageOnly’=>true,
'dateFormat'=>'yy-mm-dd',
),
              'htmlOptions'=>array(
'style'=>'height:18px',
‘maxlength’=>8,
),
));
?>
The html code obtained by the above code is as follows:
[html]

How to use yii time control_PHP tutorial

Parameter description in CJuiDatePicker
name: name
in input tag value: value
in the input tag options: Mainly related to calendar control display
showAnim: the animation effect that appears in the calendar box, optional values ​​are slideDown, show(the default), slideDown, fadeIn, fold, etc.
ShowOn: How to trigger the calendar box, both: click on the icon or input box; focus: click on the input box; button: click on the icon
buttonImage: Icon image address
​​​ maxDate: The optional maximum date, corresponding to minData
dateFormat: Calendar data format. Note that the date format of the above value must be consistent with this, otherwise the data will not match the control.
htmlOptions: Some html settings for the input box, such as style, maximum length, etc.


Note:
For more other parameters, you can refer to the jquery datepicker manual, and then put them in the options above and enclose them in single quotes.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477924.htmlTechArticleOur forms often require users to enter time. There is a very convenient time control CJuiDatePicker in Yii for use. Get The effect is as follows: Calling method [php] ?php $this-widget(zii.wHow to use yii time control_PHP tutorial
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn