如何允许使用日历按钮选择日期但禁止在 Dojo 日期文本框中输入日期? [英] How can I allow selection of a date using the calendar button but disable typing of date in Dojo Date Textbox?

查看:26
本文介绍了如何允许使用日历按钮选择日期但禁止在 Dojo 日期文本框中输入日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何允许使用日历按钮选择日期但禁止在 Dojo 日期文本框中输入日期?

How can I allow selection of a date using the calandar button but disable typing of date in Dojo Date Textbox?

有没有办法做到这一点?如果是这样怎么办?

Is there a way to do this? If so how?

基本上我希望用户能够使用日历按钮选择日期,但不允许他们手动输入日期.

Basically I want the users to be able to select a date using the calendar button but don't allow them to manually enter a date.

推荐答案

创建客户端 onfocus 事件:

Create a client-side onfocus event:

thisEvent.target.blur();

这不会阻止通过日期助手以编程方式填充字段的值,但是如果他们尝试手动聚焦(即单击或 Tab 进入)该字段,它会再次将它们踢出.

That doesn't prevent the field's value from being programmatically populated via the date helper, but if they try to manually focus (i.e. click or tab into) the field, it will kick them back out again.

这篇关于如何允许使用日历按钮选择日期但禁止在 Dojo 日期文本框中输入日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆