user1207412
user1207412

Reputation: 1

Tabbing for a multi-part HTML form

When a user hits <ENTER> after filling in the first text input field of a multi-part HTML form, how can one make it tab to the next input field rather than immediately executing the php script?

<FORM METHOD=POST ACTION="commentw.php">
Name: <input type="text" name="name" size="60"  maxlength="40">
<textarea name="comment" wrap="physical" rows="10" cols="80"></textarea>
<INPUT TYPE=SUBMIT VALUE ="Submit">
</FORM>

I have looked everywhere for a hint with no success.

Thanks in advance!

Upvotes: 0

Views: 114

Answers (1)

dangerChihuahua007
dangerChihuahua007

Reputation: 20875

I feel that the user should still press Tab to navigate around a form. This practice is popular convention, and I think users may get confused it you resort to Enter instead.

Of course, if you really wanted to do so, you must

1) Prevent the event of form submission from bubbling up the DOM (by using jQuery event.preventDefault() function for instance.
2) Set up an event handler for pressing Tab.
3) Write a function to move around the form when this event handler is evoked.

However, I wouldn't normally do this. I feel that it is counter-intuitive in terms of interface design to press enter and have a form refuse to submit.

Upvotes: 1

Related Questions