"Enter" Automatically submit a form in IE
I have a form on my website, and with Firefox when I hit "Enter" after filling in some fields the form is automatically processed as if the user hit the submit button.
But in IE, nothing happens when you hit "Enter". How can I make it so that in IE when a user hits "Enter" the form is submitted?
teammatt3 posted this at 00:14 — 1st May 2006.
He has: 2,102 posts
Joined: Sep 2003
Can you give us a link to the form? Or just the HTML code? That should show us the problem.
slpshtjack posted this at 03:00 — 1st May 2006.
They have: 2 posts
Joined: Apr 2006
Well its just a basic form...
something like
It's not a "problem" like there is a bug with the form. It's just IE doesn't automatically push submit when someone hits enter after typing something into the text field, and I would like it to. Firefox does.
da644 posted this at 22:56 — 8th May 2006.
He has: 14 posts
Joined: Apr 2006
Hi.
I just tried your simple sample form above and it worked fine in both IE and FF. However I tried it on a more complex with multiple fields and different field types (select list and radio buttons) and it did work in either IE or FF. I'm not sure there is much you can do about this.
Kind regards,
Andrew
http://www.completelyfreedating.com
demonhale posted this at 01:33 — 9th May 2006.
He has: 3,278 posts
Joined: May 2005
Usually using an input type="submit" as a function call automatically makes the form submit by pressing enter... I agree there are some issues on this, the only thing to make sure it submits is using javascript, something like an onKeypress event...
function catchEnter(e) {
if (!e) var e = window.event;
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;
if (code==13) {
//submit the form code etc...
}
}
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.