View Full Version : Where am I in the form?

08-06-2002, 06:10 AM
Is there a way to tell which form element has focus?

Or is there just a way to tell where a user is at in a form.

I'm trying to incorporate some keyboard shortcuts in a form.

There is one area with a list of 25 optional text fields.
I'd like the user to be able to use the ALT key to just to the next required field if they chose not to fill in the optional ones.

Any ideas?


08-06-2002, 06:49 AM
Try something like:

<input type="textbox" onfocus="focuselement=this.name" name="box1">

then the variable focuselement tells you which element has focus.

You can also use:


if you need to know the name of the form.

08-06-2002, 07:26 AM
Thanks x_goose_x,

I'm really looking to extrapolate the code from the elements.

In that scenario I'd have to add the onfocus to every element in the form in order to tell where a user was at. Otherwise where ever a user left the var would be that last element. What it really boils down to is that I don't want to clutter the code for only two sections of the form.

If there is a method of pulling that away from the elements that would be great.