Reputation: 645
Is there a way to stop Dojo from validating a textbox onBlur?
var textbox = new ValidationTextBox({
placeholder : "search",
name : "userQuery",
required : true,
missingMessage : "Please enter search term",
onBlur : function(){
//function to stop onBlur validation
}
}, textboxNode);
Upvotes: 2
Views: 644
Reputation: 640
Technically, yeah. But I'm not sure when it would validate if it's not onBlur.
var textbox = new ValidationTextBox({
placeholder : "search",
name : "userQuery",
required : true,
missingMessage : "Please enter search term",
validator: function(value, constraints){
if (this.hasOwnProperty("focused")) { //true if textbox is loaded
if (!this.focused) { // if textbox not focused (onblur)
return true; // considered valid
}
}
return value !== ""; // test if value is empty
}
}, textboxNode);
Upvotes: 1