Button tag in bloody Internet Explorer


8th of August 2005

I sincerely hate Internet Explorer sometimes. I never like it. Today it really pissed me off. If you use multiple <button> tags in one form, think again. It doesn't work in IE like it should do [...in Firefox]. If you have a form like this:

 <form action="showRequestVariables">
 <button type="submit" name="button1">Button1</button>
 <button type="submit" name="button2">Button2</button>
 </form>

Then, which ever button you press you'll get these request variables if you use Internet Explorer:

 button1 = "Button1"
 button2 = "Button2"

In Firefox you only get one; the one you pressed. Doesn't that seem logical? The Firfox way I mean.

To solve the problem and tame the IE bastard you'll have to loose the <button> tag and go for a <input> tag instead:

 <form action="showRequestVariables">
 <input type="submit" name="button1" value="Button1" />
 <input type="submit" name="button2" value="Button2" />
 </form>

Then you get the more sane behaviour you'd expect from a web browser.

Disclaimer: The spec (is too long to read) could prove me wrong but I feel pretty confident that Firefox has got it more right in this instance.



Comment

106 comments so far Show all 106 comments
 
Name:
Email:
hide my email address.

Your email address will be encoded to prevent email-extraction spiders from reading it so you won't get spammed if you decide to show your email address.