我们的表单中经常需要用户输入时间,yii中有很方便的时间控件CJuiDatePicker可供使用,得到的效果如下:
调用方法
[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,
),
));
?>
上述代码得到的html代码如下:
[html]
CJuiDatePicker中的参数说明
name:input标签中的name
value: input标签中的value
options:主要是日历控件显示相关的
showAnim:日历框出现的动画效果,可选值slideDown, show(the default), slideDown, fadeIn, fold 等
showOn:日历框如何被触发,both:点图标和输入框均可;focus:点输入框;button:点图标
buttonImage:图标图片地址
maxDate:可选的最大日期,对应的还有minData
dateFormat:日历数据格式。注意,上面value的日期格式必须与此处一致,否则数据不会与控件匹配。
htmlOptions:input框的一些html设置,如样式,最大长度等。
注:
更多其他参数,可以参考jquery datepicker手册,然后将其放在上面的options里,并用单引号引起来。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Zend Studio 13.0.1
Powerful PHP integrated development environment

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Notepad++7.3.1
Easy-to-use and free code editor
