April 20, 2006

IE Bug: One Text Input / Enter Key Doesn’t Submit

Filed under: Programming — dh @ 10:34 pm

Here is the fix to this quirky and aggravating bug. If you only have one input text box and you want to submit the form by pressing the enter key, IE will simply refresh the current page for you! Simply add this hidden text input between your form tags and the form will submit as expected!

<input type="text" style="visibility:hidden;display:none;" name="dummy"></input>

4 Responses to “IE Bug: One Text Input / Enter Key Doesn’t Submit”

  1. Dominick Says:

    Thank you so much!

    I’ve been at my wit’s end for a couple of hours trying to fix this bug for a client. Turns out that in the old version of the page, there was more than one input box, but in my new design, there is only one, so this situation occurs (they have to use IE, corporate stuff).

    Again, thanks.

  2. Tristan Says:

    Anyone figured out what to do if there is a TextArea in the form aswell?

  3. dh Says:

    I don’t tink it’s possible with a TextArea because the default action is to go to a new line if you are focused on it. Maybe someone else has solved this using some clever javascript however.

  4. Gerardo Bort Says:

    This works great for me 🙂

Leave a Reply