How do I get a jQuery dialog window to display only if a form validates when I click the submit butt
- by user338413
I've got a form that is using jQuery validation. When the user clicks the submit button, a dialog window displays thatshows the fields the user filled out along with the data the user entered. It asks the user if this information is correct. If it is, the user clicks the submit button in the dialog window and the form is submitted. If the user clicks the 'Fix it' button, the dialog window closes and the user returns to the form.
My problem is my dialog window displays when the user clicks the form's submit button even if there are errors in the form. I only want to display the dialog window if the form data is validated by jQuery. How do I do this?
I'm thinking of something like:
if ((#form).validates() == true) {
$('#verification_dialog').dialog('open');
}
Is there a way in jQuery to determine whether the whole form has validated? Or do I have to create my own function to do this?