This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Struts and the fly likes how to use focus attribute of html:form tag for an array of textboxes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to use focus attribute of html:form tag for an array of textboxes" Watch "how to use focus attribute of html:form tag for an array of textboxes" New topic
Author

how to use focus attribute of html:form tag for an array of textboxes

Amith Mahalingaiah
Greenhorn

Joined: Jul 12, 2004
Posts: 7
Hi
In a jsp, i have a form which has an array of textboxes called "routerName".

my form tag looks like this.......

<html:form action="/AffiliateSave" method="post" focus="routerName">

|_________|
|_________|
|_________|
|_________|
|_________|
|_________|
|_________|

i have an array of textboxes as shown above. When the jsp is served, i want the focus to be on the first textbox.

i tried giving focus="routerName"........then i got a javascript error which said "Object doesn't support this property or method"

then i tried giving focus="routerName[0]"........then i got a javascript error which said "focusControl.type is null or not an object".

i think the second option is correct but i am missing something.

Any info on this regard would be appreciated.

Thanks
Amith
Anthony Watson
Ranch Hand

Joined: Sep 25, 2003
Posts: 327
Make sure that you have an ActionForm with the routerName property and its getter/setter methods. Also make sure the form is configured in the struts config file properly. Finally, you should be using struts tags to create the text boxes.

You should not need the index number after focus="routerName".


Anthony W.<br />MCP, SCJP 1.4, SCJD, SCWCD 1.3, SCWCD 1.4, SCBCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to use focus attribute of html:form tag for an array of textboxes
 
Similar Threads
Clarify on using struts validator and javascript together
Date Validations
Weblogic Portal-Passing values from dynamically generated texboxes to a Action Form.
html : form
Accessing iframe elements in javascript