struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christophe Thiebaud <cthieb...@stylo.it>
Subject Re: focus
Date Tue, 19 Sep 2000 12:33:38 GMT
On Tue, 19 Sep 2000, you wrote:
> Hi,
> 
> The following feature is fairly common and I cannot find an easy way to have is
> handled by struts. Forgive me if it had been precedently answered.
> 
> I have a hefty struts:form full of input fields
> the validate function of my associate Form.java is impressive.
> in case the validate fails,  to be nice to the user, I want the focus to be
> set to the wrong field
> 
> Is there any solution other than writing my own form tag ?
> 

In the mean time I found a simple solution.

I have added a property get/setFocus in my fooForm.java class which holds the
name of the HTML input field

the validate function can set it.

inside my jsp. the struts:form tag includes some java:
 <struts:form   action="foo.do"
                    name="fooForm"
                    focus="<%= fooForm.getFocus() %>"
                    type="FooForm">

seems to work

thanks Christophe


Mime
View raw message