I have a form with two different submit buttons. I take a different action in php when each different submit is clicked. That is working perfectly fine.
My problem is that when one of the submits is clicked I want to pop up a “Are you sure you want to do this?” box. Then when they click ‘yes’ I want to submit the form with the button they clicked.
I also don’t want to set that submit to be default and then risk having them push enter and take the “are you sure” action without clicking yes.
Ideas?
This uses a little jQuery to add a submit handler to forms with class
needsConfirmationso that it doesn’t submit if the user doesn’t confirm the action. It uses the native javascriptconfirmmethod. Altering it to use a jQuery UI dialog is doable but requires a bit more set up.