Posts Tagged ‘dijit’

Military TimeTextBox inside InlineEditBox

May 3, 2010

After about an hour and a half looking through the tattered remains of the dojo/dijit online documentation, I was finally able to figure out what I was doing wrong trying to put a TimeTextBox inside of an InlineEditBox (with the help of the O’Reilly book and the Pragmatic Programmers book) These books have been invaluable to me not only when the Internet is dead, but when the online docs fail to deliver.

Getting the widgets nested was easy, but I had a hard time figuring out how to get the parameters to the timebox, namely. I was trying desperately to make the time box in military time.

My initial markup was something like:

<span dojoType=”dijit.InlineEditBox”
id=”start_time”
editor=”dijit.form.TimeTextBox”
editorParams=”{timePattern:’HH:mm’}”
name=”time”
onChange=”foo()”>

It turns out I had forgotten the ‘constraints’ aspect of the editorParams. So the correct code for putting a military time timetextbox inside of an inlineeditbox is:

<span dojoType=”dijit.InlineEditBox”
id=”start_time”
editor=”dijit.form.TimeTextBox”
editorParams=”{constraints:{timePattern:’HH:mm’}}”
name=”time”
onChange=”foo()”>

Doh!