Explorer's Single Textbox Form Bug

I think it is safe to say that every web site contains some kind of web form. Forms are a crucial part of our web site and allow us to interact and communicate with our visitors and registered users.
Since we often use them, we must count on them to behave as expected, but not long ago I encountered an unexpected behavior of a web form using Internet Explorer 7. As it turnes out, a colleague of mine also encountered this bug a long time ago so we're guessing this is an old bug which has not been dealt with until now. Maybe it was addressed in Internet Explorer 8? Perhaps... I haven't had a chance to check that out yet.

The bug is visible when you're using a web form which contains only a single textbox (and a submit button, of course) in Internet Explorer.

Scenario 1: When the visitor submits the form by clicking on the submit button everything works as expected: The data is being sent to the server and contains both the textbox value and the submit button value. This is the normal and expected behavior of the web form submission process.

Scenario 2: When the user inserts some data into the textbox and hits the Return/Enter key on the keyboard. Here, the form is also submitted (as expected) but this time, only the textbox data is being sent to the server! The submit button value is ignored for some reason.

Obviously, this could be of little concern to some since most of the time we don't rely on the submit button value when we want to process the submitted form's data. But sometimes, especially in automated form submission processes the system does rely on that data to be sent through and then this bug can be a real nuisance.

What about Firefox, you ask? Well, I did a small test for this bug in Firefox and there the form submission passed the test in both scenarios (clicking the button and hitting the return key).

Solution: The solution is simple, as always. All you need to so is to add a completely transparent placebo textbox to your form so the form will contain more than just one textbox field and there you go – the bug is gone!
If you're not sure how to do that, just style the placebo textbox with display:none; like so:
<input type="text" name="PLACEBO_TEXTBOX" ID="PLACEBO_TEXTBOX" style="display:none;" value="placebo_textbox_value">

I am referring to a type="text" input HTML tag when I say a textbox. Even if the HTML form has additional type="hidden" tags, the bug still exists.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.