My form has two submit buttons and I need to know which was used to submit the form. I'd like submission of the form to be disabled once it has been submitted in order to avoid double-submissions, and I'd like to use inline Javascript for that.
I can submit the form and disable a button, but the value of the button is not set since it has been disabled and I need that value to be set so I know which button was used to submit the form.
The submit button has id="submit_button" and I'm using this on the form tag:
onsubmit="submit_button.disabled = true; return true;"
<input type="submit" name="button1" value="Click me!">
. In the postback variable button1
will now only be set if this button was used. 303 See Other
to another page, or possibly even the same page, as it will be reprocessed with a GET instead of POST as method. This way it is literally impossible to double-submit.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.