validate.js
validate.js copied to clipboard
Validation messages onblur input
How can i validate onblur of each fileds of form? Is any provision to do that?
Hey, I needed that too and did some search through issues and stumbled upon this one, which can be helpful to you https://github.com/rickharrison/validate.js/issues/126
I solved this problem here by adapting the validateForm object here
function CheckOne( $field = $('[name="name"]), field = $field.attr('name') )
$field.unbind('blur');
$field.on('blur', function(e){
var valid = validator.validateOne(field),
if(valid === true){
console.log(valid); // true
this.state = 'field validates succesfully';
} else {
console.log('valid'); // [{name:"field name", message="field name required"}]
message = snwbErrorString(valid);
this.state = "field has errors"
}
});
return $field;