It’s Not a Bug, It’s a Feature… No, It Really Is. Microsoft vs. Linux

Make an HTML form with a text field and two submit buttons. Load Firefox and IE, bring the text field into view, and press the enter key.

When you have a form with one or more buttons, hitting enter under Firefox will POST the value of the 1st form button. On the other hand, with IE, unless a specific button was selected, no button values will POST.

At this point, I know a lot of people would start claiming that Microsoft is sloppy, IE is brain dead, Firefox is so much better, and more similar tripe… But think about it, how should the browser know which button is “first”? Should it be the 1st one in the HTML code? Should the “tabindex” value affect the situation? Could something be manipulating the button visibility or placement under CSS or JavaScript? Can the true human-interpreted layout even be determined by code?

And what about the question of whether the ‘enter’ key signifies “submit form”, or “submit form and the 1st button value”?

Windows has been deployed on hundreds of millions of systems, if not more. The user-base is very diverse: with different cultures, languages, and processes. If you want to cater to that user-base, you cannot make assumptions. IE is absolutely correct in not POSTing the value of an unselected form button on an ‘enter’ key press.

And this does not even touch on the fact that when you have 100s of millions of users, you also absolutely have to consider backward compatibility. Who knows how this used to work in the past, or what assumptions coders have made.

As is turns out, this really is a feature after all. And chances are, the rest of what the Linux fan-base complains about with Microsoft falls exactly along these lines. I’m all for GNU/Linux, just not mindless accusations and false claims.

submit.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
	"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>It's not a bug, it's a feature!</title>
</head>
<body>
<form action="submit.php" method="post" name="form" id="form">

<p><?php
if (isset($_POST['action'])) {
	if (isset($_POST['submit_1'])) echo $_POST['submit_1'] . '<br/>';
	if (isset($_POST['submit_2'])) echo $_POST['submit_2'] . '<br/>';
}
?></p>

<div>
	<input type="text" name="text" id="text" tabindex="1" value="" /><br/>

	<input type="submit" name="submit_1" id="submit_1" tabindex="2" value="Button 1 Clicked" />
	<input type="submit" name="submit_2" id="submit_2" tabindex="3" value="Button 2 Clicked" />

	<input type="hidden" name="action" value="submitted" />
</div>
</form>
</body>
</html>

16 thoughts on “It’s Not a Bug, It’s a Feature… No, It Really Is. Microsoft vs. Linux

  1. admin

    A few other points I would include is the Browser having to take into account multiple forms and broken HTML.

    Reply
  2. mem

    Nice opinion but… well. I have a form, with one textfield, with one button, and only one button. I push Firefox and IE. Firefox do the submit, IE don’t. Why? No Ideia.

    So… I don’t agree with your post.

    Reply
  3. admin

    That was the point of…

    And what about the question of whether the ‘enter’ key signifies ‘submit form’, or ‘submit form and the 1st button value’?

    …and also touched with the other thoughts of css, javascript, etc, manipulating the display/visibility of an element on the page.

    A well designed browser simply cannot assume that the ‘enter’ key press signifies the submit of a button — unless this is stated as so in an RFC and has also been the behavior since day 1 [for backward compatibly reasons].

    Reply
  4. Lasse

    aaahhh that most ancient of questions… the form-enter-no-go-ie-problem.
    such a simple fix:

    <!–All you do, is add a hidden field.–>

    that was for mem. now on the point of multiple form submissions with ie:
    brilliant! the only safe and useful thing microsoft have done ;-)

    Reply
  5. bro

    I couldn’t care less about this particular feature/bugg. But your basis assumption: “chances are…”
    I mean please…. there is So Mucht Against IE from the screwing with Javascript to their CSS implementations… You don’t actually believe what you write do you?

    Reply
  6. admin

    Firefox also has issues and with a growing user base will have the same exact problems as IE, probably more so.

    Reply
  7. JRM

    Yeah, I basically agree with the original post, enter shouldn’t by default do anything on a web page. It would be cool to have an attribute specify enter as a hotkey or something, but it makes me mad when there are behaviors like that, especially when they are not expected, you end up submitting half formed items, and getting yelled at for not filling in all items etc. when all you did was accidentally hit enter. If the button has the focus, enter can make submit, that works for me.

    Reply
  8. Anonymous

    “chances are, the rest of what the Linux fan-base complains about with Microsoft falls exactly along these lines.”

    “I’m all for GNU/Linux, just not mindless accusations and false claims.”

    Know yourself.

    Reply
  9. Anonymous

    Just want to add that if you have more than one input text fields, then IE will submit the form with the 1st submit button value.
    So, it is inconsistent behavior for IE itself.

    Reply
  10. Chandresh Kumar Chhatlani

    I am developing form, with a TextBox, one SelectBox and one SUBMIT button.

    It is submitting on pressing enter key, and respective alerts are displaying from JavaScript. But after JavaScript, browser sets the value of Submit Button to Null in next ASP Code.

    Hence Record could not be saved.

    Why? Any Idea.

    Reply
  11. memomg

    mem: If you can’t get a form with one field and one button to work in both browsers, your solution is “user error”.

    Reply
  12. Rick

    Interesting, I have to test in all common browsers and it’s a real pain. One “feature” (bug) of Firefox I’m having problems with is vaguely related to this. If I have a button (not submit, just a ) within a form, no matter what the onclick is for that button firefox will submit the form, IE doesn’t, it just does what the button told it to do, which is what I would expect. The only fix to this is to move the button outside the form in the code, but then I have positioning problems.

    Reply
  13. bsentosa

    I agree with this opinion. Firefox is really annoying submitting the form (POSTBACK), each time user press ENTER KEY, I notice it’s just passing the Form Validation in .NET, although it didn’t SUBMIT the form because the submission code is in the “SUBMIT button”, but it is giving POSTBACK which I don’t need it a roundtrip in the Form. This is WEB APPLICATION, NOT A DESKTOP APPLICATION.

    Reply

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>