![](/img/trans.png)
[英]Joomla 2.5 calendar field type in custom form date and time selection
[英]Joomla calendar form field read only
我创建了joomla模块并添加了日历表单字段。
<field name="date" type="calendar" default="2010-01-30" format="%Y-%m-%d" label="Enter date" description="" class="date_field" />
用户使用日历图标输入日期时,一切正常,但如果用户写入任何其他信息,则保存模块设置后一切都会崩溃。
我的想法是让输入字段只读,但如果我使用readonly =“true”,那么callendar图标就会消失。
我想你需要做一些mootools或jquery-magick(取决于你的joomla版本)来禁用文本框中的手动输入。 使用jquery你可以做类似的事情:
jQuery('.calendar-textfield-class').focusin(function (event){
event.preventDefault();
jQuery(this).next('button').focus().click();
});
如果用户尝试手动输入日期,则应触发日历选择弹出窗口。
关心乔纳斯
jQuery(document).ready(function(){
jQuery(document).on('keydown', '#jform_scheduled_time', function(event) {
return false;
});
});
Try this and user will not able to write anything in calendar box and for opening calendar pop up on click anywhere do this-
jQuery(document).on('focusin', '#jform_scheduled_time', function(event) {
event.preventDefault();
jQuery(this).parent().siblings(':eq(0)').show();
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.