title: Where is it best to add a confirmation dialog popup
body: <p>I am using <code>ASP.NET MVC 4</code> and the latest version of <code>jQuery UI</code> and <code>Fluent Validation</code> to handle my server side validation.</p>
  
  <p>I am trying to get a <code>jQuery dialog</code> to work as a confirmation popup before the form is submitted. The user should click yes to submit the form or cancel to stay on the form.</p>
  
  <p>I have Googled and tried the samples given but I can't get it to work.  I have tried doing this on the button's click event, didn't work.  Now I am trying to add it to the form submit.</p>
  
  <p>My HTML markup:</p>
  
  <pre><code>&lt;button id="SaveButton" type="submit"&gt;Save&lt;/button&gt;
  
  &lt;div id="dialog-confirm" title="Save Customer?"&gt;
       &lt;p&gt;&lt;span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"&gt;&lt;/span&gt;Are you sure you want to save this customer?&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>My jQuery code:</p>
  
  <pre><code>$(document).ready(function () {
       $('form').submit(function () {
            $('#dialog-confirm').dialog('open');
            return false;
       });
  
       $('#dialog-confirm').dialog({
            autoOpen: false,
            resizable: false,
            modal: true,
            buttons: {
                 'Save': function () {
                      $('form').sumbit();
                 },
                 Cancel: function () {
                      $(this).dialog('close');
                 }
            }
       });
  });
  </code></pre>
  
  <p>The error that I get using the method above is:</p>
  
  <pre><code>Object doesn't support this property or method
  </code></pre>
  
  <p>...and it breaks on <code>$('form').sumbit();</code></p>
  
  <p>How do I get this to work properly? And where is it best to add this? On the button or when submitting the form?  Both?</p>
  
  <p><strong>NOTE:</strong> Answers need to be based on <code>jQuery</code> and the <code>jQuery dialog</code> control.</p>