I have two submit buttons in a form. How do I determine which one was hit serverside?
There’s a new HTML5 approach to this, the formaction
attribute:
Apparently this does not work in IE9 and earlier, but for other browsers you should be fine (see: w3schools.com HTML
Personally, I generally use Javascript to submit forms remotely (for faster perceived feedback) with this approach as backup. Between the two, the only people not covered are IE<9 with Javascript disabled.
Of course, this may be inappropriate if you’re basically taking the same action server-side regardless of which button was pushed, but often if there are two user-side actions available then they will map to two server-side actions as well.
Edit:
As noted by Pascal_dher in the comments, this attribute is also available on the tag as well.