I find that Rich LaMarche's solution is not yet perfect. E.g. in IE6 - may it burn in hell - it does not work if you want to use two buttons with the same name. Example:
I use a MVC architecture and "choice" is the variable that I use to determine which step to take next. If you try to do it as above, even with Rich's patch, IE6 will still overwrite "choice" with the innerHTML of the second button ("2"), and that will be the value of "choice".
However, the following works: change the name attribute to something else, e.g. "choiceV". Then:
This takes care that only one button will be sent with name "choice", the other one will remain "choiceV", and your controller can use "choice" to properly determine the action to be taken. It does add a short delay to the processing of the page, but does not need JavaScript. Firefox can handle it as well. I dislike such patches immensely, but here I have no choice... but I will add the "Spread Firefox" button to my homepage now.
Comment
I find that Rich LaMarche's solution is not yet perfect. E.g. in IE6 - may it burn in hell - it does not work if you want to use two buttons with the same name. Example:
<button name="choice" type="submit" value="submitLogin" onClick="this.setAttribute('value', 'submitLogin');">1</button>
<button name="choice" type="submit" value="submitCancel" onClick="this.setAttribute('value', 'submitCancel');">2</button>
I use a MVC architecture and "choice" is the variable that I use to determine which step to take next. If you try to do it as above, even with Rich's patch, IE6 will still overwrite "choice" with the innerHTML of the second button ("2"), and that will be the value of "choice".
However, the following works: change the name attribute to something else, e.g. "choiceV". Then:
<button name="choiceV" type="submit" value="submitLogin" onClick="this.setAttribute('value', 'submitLogin'); this.setAttribute('name', 'choice');">...</button>
<button name="choiceV" type="submit" value="submitCancel" onClick="this.setAttribute('value', 'submitLogin'); this.setAttribute('name', 'choice');">...</button>
This takes care that only one button will be sent with name "choice", the other one will remain "choiceV", and your controller can use "choice" to properly determine the action to be taken. It does add a short delay to the processing of the page, but does not need JavaScript. Firefox can handle it as well. I dislike such patches immensely, but here I have no choice... but I will add the "Spread Firefox" button to my homepage now.