I have a nested form that uses jquery validate My question is , Can we validate/not validate entire form based on certain values?. For example I have a nested form with save / submit buttons. I want to validate only on Submit. My problem is that I have the class="required" on each field as the form is very complex and I build it on the fly. Please help.
(function($){
$(document).ready(function() {
$(".form").validate({
debug:true,
errorClass: "errormsg",
ignore: ':hidden',
meta: 'validate',
submitHandler: function(form) {
if ($("#stype").val() == "Submit") {
}else{
form.submit();
}
}
});
} );
})(jQuery);
My html looks somthing like...
<tr>
<td width="55%">Name of Service</td>
<td>
<input class="required" id="application_contact_attributes__name" name="application[contact_attributes][name]" size="30" type="text" value="Demo Service 10" />
</td>
</tr>