Find an example of validating a field using dojo
JS Header
================================================================================================================
dojo.require("dojo.parser");
dojo.require("dijit.form.Form");
dojo.require("dijit.form.NumberTextBox");
dojo.require("dijit.form.ValidationTextBox");
function StartSegmentOffsetNU() {
var props = {
name: "StartSegmentOffsetNU",
value: 0,
constraints: {min:0,
max:document.forms[0].StartSegmentLength.value,
places:0
}
};
new dijit.form.NumberTextBox(props, "StartSegmentOffsetNU");
}
function EndSegmentOffsetNU() {
var props = {
name: "EndSegmentOffsetNU",
value: document.forms[0].EndSegmentLength.value,
constraints: {min:0,
max:document.forms[0].EndSegmentLength.value,
places:0
}
};
new dijit.form.NumberTextBox(props, "EndSegmentOffsetNU");
}
var init = function(){
console.log("This runs when page is ready." +
"It will appear in the console");
};
================================================================================================================
onload
dojo.addOnLoad(init);
dojo.addOnLoad(StartSegmentOffsetNU);
dojo.addOnLoad(EndSegmentOffsetNU);
================================================================================================================