This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts error, focus the error field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts error, focus the error field" Watch "Struts error, focus the error field" New topic

Struts error, focus the error field

Nilesh Naik

Joined: Jul 18, 2006
Posts: 13
I have a struts jsp and ActionForm for that jsp. The form validation is done in the action form.If there are any errors, those are displayed on the jsp.
I want to get the focus on the first error field on the jsp.

Can anyone let me know how to do that?

Jan Groth
Ranch Hand

Joined: Feb 03, 2004
Posts: 456
i dont know of any mechanism you could use...

guess you will need a scriptlet / js which parses the error map in the request / session and focuses the right field on the page if a appropriate error is found.

no rocket science, but you'll probably need a few hours to test and implement.

also note that "the first field" is something you can usually not decide automatically.


happy coding,
[ January 19, 2007: Message edited by: Jan Groth ]
Have you checked out Aspose?
subject: Struts error, focus the error field
jQuery in Action, 3rd edition