struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wendy Smoak <>
Subject Re: Setting focus on invalid form submission
Date Mon, 02 May 2005 19:56:12 GMT
From: "Randy Kennedy" <>

> I am wondering if there is a way to set the focus after a form has been
> validated through Struts and deemed invalid?  Currently, focus always
> goes to the first form element.  Is there not a way to make this go to
> the first INVALID form element?

I think you could do it fairly easily with Struts-EL...

<html-el:form action="/chooseProfile" focus="${focusField}">

Now all you have to do is set a request Attribute named 'focusField' with
the name of the appropriate form element.  I'm thinking... override
'validate' in your Action, call super.validate(...) and you'll have the
errors.  Figuring out which one is "first" might be problematic though...

Wendy Smoak

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message