Changing Default Behavior of Enter Key in Forms

She has: 88 posts

Joined: Sep 2001

I'm being asked to change the default behavior of pressing the Enter key in forms from submitting the form to making it act as the Tab key (moving the cursor from field to field).

Is this possible? I know I can keep the form from being submitted if the Enter key is prematurely pressed, but how would one change it to act like the Tab key?

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

Not a good idea to change default behaviours in the first place. Smiling

It's even more dangerous since you'll have to use Javascript. What if the user has JS turned off in their browser? Suppose you put instructions on the page to hit enter, and it submitted instead? Smiling

He has: 1,758 posts

Joined: Jul 2002

It can be done... I'm sure I saw a script to do it either on wsabstract.com or dynamicdrive.com

Like Abhishek says... Don't do it.

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.