I have one form with around 50 fields and two submit buttons, \"SAVE\" and \"SAVE & SUBMIT\". If the user clicks \"SAVE\", then validate only some values, eg. field1, fi
If you have the below two buttons:
You can validate and submit based on the two buttons:
Save sends with ajax and no reload. Next button saves and redirects to next page.
$('form').validate({
submitHandler: function(form, e) {
var button = $(":focus", this);
var name = button.context.submitButton.defaultValue;
console.log(name);
if(name == "Save"){
$(form).ajaxSubmit();
}else{
form.submit();
}
}
});
checkout this post: https://stackoverflow.com/a/61423083/1004799