title: Confirmation to pause form submit until Ok has beenpushed
body: <p>I have a form that a confirmation dialog pops up (do you want to continue) right now it pops up but the form is being sent to my controller at the same time, which begins processing regardless if you hit yes or no.  How do I pause the form submit until after the javascript confirmation has been shown/selected.</p>
  
  <pre><code> @using (Html.BeginForm("Process", "Home", FormMethod.Post, 
   new { id ="MyForm" })) {  
      @Html.TextBoxFor(m =&gt; m.Name); 
      // other form controls...
      &lt;input id="Submit" type="submit" value="Apply Changes" /&gt; 
   }
  </code></pre>
  
  <p>javascript: (using jquery-ui)</p>
  
  <pre><code> $(function () {
          $("#Confirm").dialog({
              autoOpen: false,
              buttons: {
                  "Ok": function() {
                      $(this).dialog("close");
                      $('#MyForm').submit();
                      return true;
                  },
                  Cancel: function() {
                      $(this).dialog("close");
                      event.preventDefault();
                      return false;
                  }
              }
          });
  
          $("#Submit").click(function () {
              $("#Confirm").dialog("open");
          });
      });
  </code></pre>