The proper way to do that is to extend from the DateTextBox
and define your constraints.
For example:
declare("CustomDateTextBox", [DateTextBox], {
postCreate: function() {
this.inherited(arguments);
this.set('constraints', {
min: '08/22/2008',
max: new Date(),
datePattern: 'dd-MMM-yyyy'
});
}
});
This ofcourse means that you need to use CustomDateTextBox
in stead of DateTextBox
. If you really want to use the dijit/form/DateTextBox
you can define the name dijit/form/DateTextBox
but I don't recommend it because if you would ever need the default DateTextBox
too, you can't.
The this.inherited(arguments)
is also very important since it will run a super-call, this means that the default postCreate
will also be called (without it your widget won't work).
I also made a full example at JSFiddle, if you want to use dijit/form/DateTextBox
you can use this example.
EDIT: I just noticed you're using Dojo 1.6. The code won't work but the idea is the same, just extend your widget and it will work.
EDIT 2: This code might work with Dojo 1.6.