IE not passing value of <button> tag properly? (pointer)
Posted on 2005-10-18
I'm converting some forms on my site to use the <button> tags instead of <input type="submit"> fields (for skin based CSS styling). In Firefox and Opera they work just fine, but I found an annoying bug in IE and was wondering if anyone has found a way to get the to work properly.
I make a button tag like:
<button type="submit" name="theButton" value="buttonValue">Button Text</button>
When I click that button and the form submits, the browser is supposed to pass in a parameter named "theButton" with a value of "buttonValue". With this logic, I can put two different buttons in the same form and let my JSP do different actions based on which button was pressed. Opera and Firefox do this just fine.
The problem comes in with Internet Explorer. Instead of passing in the name/value pair of the button that was pressed, it passes in the "content" of the button tag for each button in the form, regardless of which one was pressed. In my example above, the parameter named "theButton" would have a value of "Button Text". If I had a second button called "theOtherButton", it's name/content pair would also be passed in, even if it was not pressed. This bug makes it so my JSP code can't just check for which button was pressed since all the buttons are being passed in.
There are a couple work arounds that I have thought of:
Seperate the forms for each button (real ugly on certain forms, not possible on others).
Any others or perhaps a fix?