0

I've simple MVC View for employee registration and when user click on "Create Employee" button, I’m displaying Jquery confirmation dialog.

How can I stop showing confirmation dialog when MVC View has Data Annotation errors.

Thanks, -Naren

Narendra V
  • 595
  • 1
  • 8
  • 21
  • Where is the dialog being called from? Can you post code? – Steve Mallory May 27 '11 at 13:46
  • – Narendra V May 27 '11 at 14:06
  • Narendra - if you mark questions as answered it will increase your accept percentage and people will be more likely in the future to help. Right now you at at 40% which isn't very good : ) – Adam Tuliper Jun 03 '11 at 18:42

1 Answers1

1

Its basically the same as defined here

How to fire jQuery function only if form is valid

check if the form is valid:

$(function () { 
    $('#yourForm').submit(function () { 
        if($(this).valid()) { 
           //call dialog
        }
        else {
           //not valid
        }
    }); 
}); 

Community
  • 1
  • 1
Adam Tuliper
  • 29,982
  • 4
  • 53
  • 71