Reputation: 1850
I need to pick birth date and the condition is user must be older than 18 years and less than 100 years. How to set constraints for dijit.form.DateTextBox? Please anyone help me to do so.
Upvotes: 1
Views: 2049
Reputation: 2277
Require dojo/date
and name the parameter in your require statement date
.
Then do something like:
dateTextBox.set("constraints", {
min: date.add(new Date(), "year", 18),
max: date.add(new Date(), "year", 100)
});
Upvotes: 0
Reputation: 50
try the following:
var test2 = new dijit.form.DateTextBox({
constraints: {
min: dojo.date.add(new Date(),"year",18),
max: dojo.date.add(new Date(),"year",100),
}
},document.createElement("div"));
Greetings, Simon
Upvotes: 1