title: Use fancybox to allow/prevent form submission
body: <p>Below is the jQuery I'm using to try and prevent/allow a form to be submitted once the user clicks the submit button. The idea will be to present a fancybox modal dialog window with the data the user entered for review. If they ,like, they click <code>Looks Good!</code> and the form is submitted back to the ASP MVC3 controller. If not, since the <code>e.preventDefault</code> method has already been called the modal window closes and they can re-enter the data. </p>
  
  <p>The problem is, obviously as I have this written now, if the user is happy with the data they've entered, the whole thing will go into an infinite loop since I'm the <code>Look's Good!</code> button calls the method that displayed it in the first place. </p>
  
  <p>Is there a way to create a "standalone" method inside the <code>submit()</code> function so I would have access to the event object and, if not, what would be a better way (i.e. actually works) to allow the form to submit after clicking the <code>Look's Good!</code> button? </p>
  
  <pre><code>    //Form submit functions
      $('form').submit(function (e) {
          e.preventDefault();
          if ($('#AccountNumber').val() != $('#doubleaccount').val()) {
  
              alert("Please re-enter the correct account number!");
          } else {
              var display = "&lt;h1&gt;Test&lt;/h1&gt;" +
                            "&lt;input type='button' value='Looks Good!' onclick='submit()'/&gt;" +
                            "&lt;input type='button' value='Try Again...' onclick='cancel()'/&gt;";
              $.fancybox(display, {
                  // fancybox API options
                  fitToView: false,
                  autoScale: true,
                  autoDimension: true,
                  closeClick: true,
                  openEffect: 'fade',
                  closeEffect: 'fade',
                  closeBtn: true,
                  openSpeed: 'fast',
                  closeSpeed: 'fast'
              });
          }
      });
  });//End doc.ready()
  
  function submit() {
      $('form').submit();
  }
  
  function cancel() {
      $.fancybox.close();
  }
  </code></pre>