I need a modal with a form inside to close only if submission is succesfull : <p>I have a form in a modal.
I'm using standard mvc form validation and have set an event so that when a button is pressed the modal shows up and after the user submits the form the modal re-hides. The problem with that is that if the form is not valid the modal still closes and the error messages show only if it re-opens. I need a way to trigger the event only if the form is accepted as valid by the controller.</p>

<p>The event looks for clicks on button that have the .toggleMOD class(too lazy to create 2 events per id)</p>

<p>If you guys need to see any code i will include it but the trigger i want to create is about default mvc submission validation aka "if (ModelState.IsValid)"</p>
