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.

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.

Previous:
Worst album covers (updated) August 7, 2005 Misc. links
Next:
Dream Theater - Octavarium August 11, 2005 Music
Related by category:
Fastest way to find out if a file exists in S3 (with boto3) June 16, 2017 Web development
Be very careful with your add_header in Nginx! You might make your site insecure February 11, 2018 Web development
<datalist> looks great on mobile devices August 28, 2020 Web development
How to have default/initial values in a Django form that is bound and rendered January 10, 2020 Web development
Related by keyword:
Getting uploadify to work July 17, 2009 Web development
Future of Web Apps (quick summary and thoughts) October 4, 2007 Web development
Annoying Safari just ate my blog March 20, 2006 macOS
Changing the size of a textarea box August 18, 2004 Web development

Go to top of the page