Ezilon.com - Target Your Audience, be Seen in Your Region

"Enter" Automatically submit a form in IE

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.

They have: 2 posts

Joined: Apr 2006

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's picture
Moderator

He has: 1,937 posts

Joined: Sep 2003

Can you give us a link to the form? Or just the HTML code? That should show us the problem. Smiling

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.

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.

demonhale's picture

He has: 3,301 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...
}
}

Subscribe to this feed: Syndicate content