I would like to display a confirm dialog box “Are you sure?” when user clicks the submit button but this confirm dialog box should be displayed only if client side validations (created using MVC3 validation attributes) have passed. But the event is firing before:
$("#submitbutton").click(function () {
if (confirm("The overall rating is less than 3. Are you sure you want to submit the PEMS?")) {
return true;
}
return false;
});
How do I fix this?
Found the answer:
We need to use $(formselector).valid() like this: