Why is this jquery dialog window not displaying?

Posted by user338413 on Stack Overflow See other posts from Stack Overflow or by user338413
Published on 2010-05-13T19:53:38Z Indexed on 2010/05/13 20:14 UTC
Read the original article Hit count: 195

I've got a form that is using jquery validation. When the user clicks the submit button, I've got some jquery that intercepts the submit and should display a dialog window asking the user to verify the information they entered on the form. This dialog window should only display if the form has validated. Here is my code:

$('#form').submit(function(){
    fillVerificationDialog();   /* This loads up the dialog with form data */
    if (('#form').valid()){
        $('verification_dialog').dialog('open');
        return false;
    }
});

My dialog window is not displaying. It just submits the form. And I've verified that the form is valid by using an alert that checks the value of $('#form').valid()

If I remove the if statement and just have the line that opens the dialog, the dialog displays. However, it will display even if the form has errors which is what I'm trying to prevent.

© Stack Overflow or respective owner

Related posts about jquery-ui-dialog

Related posts about jquery-validate