Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Last field accessed

Status
Not open for further replies.

angel0910

Programmer
Jun 26, 2002
17
0
0
SG
hello :)

are there any ways to get the field name of the last one accessed by the user?
example:
the user selects something from the <SELECT> list and the page refreshes...
i would like to grab the name of tat field tat was last accessed by the user..
any idea?

thanxs :)
 
you can define a global var called lastfield, then in all elements you create an onBlur event to set the value of the lastfield var as the name of that field.

this var can be an hidden in this form.

When you reload the page, you can check the value of the hidden and the put a focus to the field in the hidden var.

Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
Anikin, when you reload a page ALL variables (regardless whether they are local or global) are set to default values. The same thing happens to all form field values.

angel0910, in order to do what you want you have to pass the values of form elements that you are interested in through URL so it lookes like this:
webpage.html?var1=value1&var2=value2
Then, when page is reloaded, you need to read url string and set form elements according passed values.
This is the way do it - of course, if you don't want to use any server-side scripting.

Search this forum on how to pass/read values via URL, you'll find threads explaining exactly how to do it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top