Elvira
Elvira

Reputation: 23

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

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

Upvotes: 1

Views: 1866

Answers (2)

Rajat Talwar
Rajat Talwar

Reputation: 11912

Just set the popupClass key of the dijit to ""

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

Upvotes: 0

percy
percy

Reputation: 56

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" />

Upvotes: 2

Related Questions