0

I want to have a dialog box popup letting a user know of consequences when hitting the continue button, preferably styled better than a standard browser popup.

I got jqdialog, a jquery plugin, and this was my solution:

I have a view with the following HTML:

<form id="formSubmit" action="<%= ResolveUrl("~/Summary/Summary") %>" method="post">
   <input type="button" name="summaryButton" id="bt-confirm" value="Continue »" />
</form>

and I've bound a click event to the button with some JQuery:

    $('#bt-confirm').click(function () {
        $.jqDialog.confirm("Are you sure want to continue?",
                function () { CallSubmit(); },  // callback function for 'YES' button
                function () { alert("This intrusive alert says you clicked NO"); }  // callback function for 'NO' button
            );
    });

My CallSubmit() gets called, but the form does not get submitted:

  function CallSubmit() {
      var submitURL = '<%= ResolveUrl("~/Summary/Summary") %>';
      alert(submitURL);

      document.formSubmit.submit();   // This is NOT posting back to the controller          
  }

Is there a better/easier way to do this? What is wrong with my JQuery submit?

Any help would be appreciated.

1 Answer 1

1

Try replacing:

document.formSubmit.submit();

with:

$('#formSubmit').submit();
Sign up to request clarification or add additional context in comments.

2 Comments

Doh! Thanks ongle, that worked. Also, is this a good way of doing a confirmation or is there a better way?
We do almost the same thing in our applications and it works fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.