jQuery Validate Issue with form.reset and validator.resetForm -
i have form required fields. if user clicks button, validation should fire, , input processed. however, after processing, want reset/clear form , allow them enter more information. after call form.reset() , validator.resetform() though, validation messages shown because form has been cleared. proper way clear form , ensure no validation messages appear? here's complete fiddle illustrating issue. here's code snippet i'd working:
$('#btngo').click(function(){ // clear form $('#frmfoo')[0].reset(); // after call resetform, validation message shown again. why? validator.resetform(); });
thanks,
andy
the jquery validate plugin, default, treats button
element submit, why validation messages come right during/after reset.
you need add type="button"
button doesn't trigger submit.
<button type="button" id="btngo">do , clear form</button>
Comments
Post a Comment