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.

Comments

Page 2 of 2

Post your own comment
quan

well, you might want to try adding a "value" to the button tags you used...or better yet, why not just simply use <input>???????????????????

Peter Bengtsson

The value attribute on the button tag is browser ambigious, meaning that the IE sends a different value than Mozilla. (IE sends the value and the content of the tag)

Anonymous

why not just simply use <input>???????????????????

simple, semantic markup

<button> is much more samentic than <input>

also provides some css benifits

Anonymous2

why not just simply use <input>???????????????????

there should be a way to set a button's caption different from it's value

is supossed to think that <button> was created to resolve this

Anonymous

first - understand what and how button works - then comment. When you ask why not use input??????? - you clearly don't understand what the difference is.

Your email will never ever be published.

Related posts

Go to top of the page