开发者

How to disable time picker on dijit TimeTextBox of dojo toolkit?

开发者 https://www.devze.com 2023-03-21 00:47 出处:网络
I implemented the dijit TimeTextBox in my code. When clicking in the textbox the time picker appears and I can set the time, e.g. 08:00.

I implemented the dijit TimeTextBox in my code. When clicking in the textbox the time picker appears and I can set the time, e.g. 08:00. Is there a way to disable the time picker, so that the user has to enter the time manually. I'd like to keep the validation feature of dojo.

I tried to set openOnClick=false but it had no effect. The documentation on http://dojotoolkit.org/api/1.6/dijit/form/TimeTextBox tells me, that it should activate the drop down if set to true.

Any help开发者_运维问答 is greatly appreciated.

Many thanks, Elvira


Probably there is no way to disable the drop down for the TimeTextBox yet. Setting openOnclick to true just insures that the drop down is shown upon clicking anywhere on the textbox. If you just need the validation and not the time picker, following might just help. I have used "dijit.form.ValidationTextBox" with the regex validation.

        <input name="time1"
           maxLength="8"
           id="time1"
           dojoType="dijit.form.ValidationTextBox"
           regExp="(1[0-2]|0[0-9]|[0-9]):[0-5][0-9] (A|P)M"
           promptMessage="hh:mm AM/PM"
           invalidMessage="input time pattern should be of the form hh:mm AM/PM" />

OR

        <input name="time2"
           maxLength="8"
           id="time2"
           dojoType="dijit.form.ValidationTextBox"
           regExp="(2[0-4]|[0-1]?[0-9]):[0-5][0-9]:[0-5][0-9]"
           promptMessage="hh:mm:ss"
           invalidMessage="input time pattern should be of the form hh:mm:ss" />


Just set the popupClass key of the dijit to ""

timeTextBox.set("popupClass","");

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号