I want to manually trigger validation including showing error messages with jQuery Validate.
The scenario I am trying to accomplish is a form like this:
<form>
<input id=i1> <button id=b1>
<input id=i2> <button id=b2>
</form>
When clicking b1
, only i1
should be validated. hen clicking b2
, only i2
should be validated. However all fields must be posted. How can I do this? I thought about handling the click event for b1/b2
and manually validating a part of the form.
That library seems to allow validation for single elements. Just associate a click event to your button and try the following:
$("#myform").validate().element("#i1");
Examples here: