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