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

如何允许使用日历按钮选择日期但禁止在 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.