Wednesday, July 23, 2008

Customizing dojo DateTextBox

Sometimes things aint that easy when you really want to get something done in your way. I too felt like that when I wanted dijit.form.DateTextBox to display date in format dd-mm-yyyy. Many talked about using right locale. But I was not concerned about any locales but the format I wanted to get. So here is how you do it in dojo.
<input  id="date" 
value="2008-12-01"
dojoType="dijit.form.DateTextBox"
constraints="{datePattern:'dd-MM-yyyy'}"
invalidMessage="Invalid date dd-mm-yyyy"
promptMessage="dd-mm-yyyy"
/>

4 comments:

arhathq said...

Thank you for post very much.

bitkidoku said...

Thank you, this exactly is the information I needed

vk2tdt said...

Actually allyou needed to do was add dojo.require('dojo.date.locale'); within your header text and locales automatically follow the browser settings!

Vinnu313 said...

Thanks a lot.... Saved a lot of time..... :)