Force an error on a field with Parsley.js -
i'm using parsley (1.x) client-side validation of form. need force error on field after server-side validation.
<form> <input type="text" name="field1" > <input type="text" name="field2" > <input type="submit" value="send"> </form>
i've tried methods described in page doesn't work: https://github.com/guillaumepotier/parsley.js/issues/111
anyone can me?
thx
i've managed resolve issue writing new validation rule return alwais invalid field.
forcevalidation : function() { return { validate : function(val, elem, self) { return false; }, priority : 32 }; },
when receive ajax response add validator affected field , remove it:
affectedinput.attr('parsley-forcevalidation', true); affectedinput.attr('parsley-error-message', errormessage); affectedinput.parsley('destroy'); affectedinput.parsley('validate'); affectedinput.removeattr('parsley-forcevalidation');
Comments
Post a Comment