Forum Moderators: phranque

Message Too Old, No Replies

Forms? Jump from Field to Field.

A person is completed with one field, automatically jumps

         

bartainer

1:02 am on Sep 9, 2005 (gmt 0)

10+ Year Member



Hello,

I know how to build forms, however. I lack one skill: How do I create a form where a person's cursor automatically jumps to the next field when he/she completes the prior field? E.g. I'm done filling out the "phone" field and now the cursor automatacally jumps to the "state" field on the form. How and please explain.

Thanks

txbakers

1:22 am on Sep 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You would use the onChange method of the input box.

OnChange, check the length of the value of the box. Once it reaches your limit of characters, set the focus to the next box.

rogerd

1:26 am on Sep 9, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Bartainer, note that it will only work if the number of characters is always the same for a completed field. Thus, a US Area Code always has three characters, so you can automatically jump to the next box. You couldn't do it with "City", since there's know way of knowing that "Cleveland" is a completed entry.

bartainer

1:53 am on Sep 9, 2005 (gmt 0)

10+ Year Member



Javascript? Or can I use PHP?

txbakers

3:31 am on Sep 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



javascript - this is a client side process, not a server side process.

And, if the user has javascript turned off, it wouldn't work anyway.

Rogerd makes a good point. It only works on fields where you know the max number of chars.

Personally, from a usability view, I don't like those types of "enhancements."

jomaxx

4:39 am on Sep 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



NOT a good idea. This will confuse people more than aid them.

For example, I frequently manage drop-down lists via the keyboard. You can use the up/down arrows, press a letter and the menu jumps down to entries beginning with that letter, etc. The last thing I was is for some Javascript snippet to decide when I am done filling in a field and move me to the next one, because there is no way in principle for it to know that.

Also what about people who use the tab key to jump to the next field, only to find that the JS had moved them automatically and they're suddenly typing in the wrong field?

Even your phone number example is far from straightforward. What if they're not in the US? What if they need to type in an extension? What if they mistype a digit and want to back up and edit it?

kaled

9:15 am on Sep 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There's only one instance when this is useful that I have seen and that is logging into bank accounts, etc. In cases where you are asked to enter the 3rd, 5th and 7th letters of your password (in separate boxes) this saves a few key presses.

Moving the focus is useful if validation fails, but in normal forms, that's about the extent of it.

Kaled.

bartainer

1:11 pm on Sep 9, 2005 (gmt 0)

10+ Year Member



Thanks all! Very imformative! I will NOT have this feature.