Hello,

I want to have a confirmation dialog before a form is submitted. I am using JQuery and the dialog from JQuery-UI.

My problem is that the form is never submitted, even when event.type is "submit" (meaning the event is being triggered by the Continue button callback). When "Continue" is clicked the "if" block in the event handler is certainly executed, and because the submit event is triggered from open dialog, the default has not been prevented:

Code:
$(document).ready( function() {
   
   // Due date confirmation dialog
   $('#dueDateDialog').dialog({
      autoOpen:  false,
      modal:     true,
      resizable: false,
      buttons: {
         Continue: function() {
            $('#changeDueDate').submit();
         },
         'Back to Incident': function() {
            $(this).dialog('close');
         }
      }
   });
   
    $('#changeDueDate').submit( function(e) {
        if ( $('#dueDateDialog').dialog("isOpen") ) {
            $('#dueDateDialog').dialog('close');
            return true;
        }
        else {
            $('#dueDateDialog').dialog('open');
            e.preventDefault(); 
        }
    });
    
});
Any ideas? Thank you!

Julio