| Author |
question on changing focus
|
Nandu Raghu
Greenhorn
Joined: Nov 21, 2003
Posts: 12
|
|
Hi, I have 2 textboxes and one checkbox. When I click on the checkbox, I want to do some validation and then put the focus on textbox 1 if the validation fails. I am not clear on how to change the focus back to the textbox 1. Any help will be appreciated. Thanks.
|
 |
sandy gupta
Ranch Hand
Joined: Jan 30, 2001
Posts: 228
|
|
|
use javascript form onLoad method to see if there is any error to make the focus for the form to the check box. that will work.
|
Adios
|
 |
Nandu Raghu
Greenhorn
Joined: Nov 21, 2003
Posts: 12
|
|
Thanks for your response, Sandy. I am still not clean how the onLoad handler would help me in this case. Can you please explain a little more. Thanks.
|
 |
Franck Tranchant
Ranch Hand
Joined: Aug 07, 2003
Posts: 75
|
|
This is basically a JavaScript problem. Right after your validation, probably in the OnChange() method of your checkbox, you could add javascript similar to this : <...> document.forms["form_name_here"].elements["textbox1_name_here"].focus(); <...> Then textbox1 should get the focus...
|
Franck<p>--------------------
|
 |
Nandu Raghu
Greenhorn
Joined: Nov 21, 2003
Posts: 12
|
|
Thank you FrancK. It worked !! [ November 27, 2003: Message edited by: Nandu Raghu ]
|
 |
 |
|
|
subject: question on changing focus
|
|
|