jQuery in Action, 2nd edition*
The moose likes Struts and the fly likes javascript setfocus Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "javascript setfocus" Watch "javascript setfocus" New topic
Author

javascript setfocus

charu setia
Greenhorn

Joined: Nov 01, 2007
Posts: 4
Hi all,
I have a problem with the javascript page.Its like i have around 76 fields in my Jsp.from Jsp i m calling my javascript page.there some validations are occuring for all the fields.if a user enters some wrong value, say for some 40th field, the error message will appear.when the user clicks "ok", the wrong value entered will be selected but the focus goes to the top og page.i want the focus to come on that particular field.
I am already using select() method for selecting the value.
I also tried with setfocus() and focus(), but of no use.
If anybody can can help me out, plase reply
Thankks in advance
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
One way to do this is to include JavaScript code similar to the following in a function that is executed from the body's onload event.

Unfortunately, if you have 40 different properties, you'll have to repeat this code 40 times.


Merrill
Consultant, Sima Solutions
 
 
subject: javascript setfocus
 
Similar Threads
Experiencing odd behavior using ICEfaces app in Internet Explorer
mark field in javascript !
focus() function
Struts2 Datetime Picker focus is not set using javascript
Spooky tabindex problem...