I have a form with multiple submit buttons. When one of those button is clicked, I would like to present a confirmation popup asking the user to confirm the chosen action. If he presses OK, allow the form post. If not, cancel it.
Problem is that I can’t figure out the correct selector to use on the submit handler. Here’s what I currently but I get an undefined result:
$("form").submit(function() {
if ($("input[type=submit][clicked=true]").val() == "New") {
// TODO - this isn't getting called.
}
}
I read somewhere else that this code worked for someone, but it doesn’t work for me in IE.
Any help is appreciated. Thanks!
Some may agree with what I’m about to suggest — but oh well.
Instead of having your true submit button be clicked and overridden to show the modal dialogue, why not just have that initial button just trigger the popup and then have the real submit button in there. The cancel button will simply close the modal.
Then with jquery write something like:
here, the submit will not require any special javascript to submit.