validate.js icon indicating copy to clipboard operation
validate.js copied to clipboard

Validation messages onblur input

Open akshays-iprogrammer opened this issue 8 years ago • 2 comments

How can i validate onblur of each fileds of form? Is any provision to do that?

akshays-iprogrammer avatar Feb 24 '17 14:02 akshays-iprogrammer

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

RusinovAnton avatar Mar 05 '17 13:03 RusinovAnton

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;

BinaryGeometry avatar Jan 29 '18 07:01 BinaryGeometry