struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: focus
Date Tue, 19 Sep 2000 15:49:08 GMT
I think the solution you came up with (using your own "focus" property) is pretty
clever, and looks like a recommended way to do this.  The only thing you will want to
be sure of is to initialize the "focus" property to the name of the first field on
the screen when the form bean is first created, so that you don't get a JavaScript
error (bad field name) the first time that the form is displayed.

Craig McClanahan


"DONNACHA RYAN ..." wrote:

> this is Donncha Ryan not Don Ryan , try emailing , but check for correct address
>
> Date sent: Tue, 19 Sep 2000 14:33:38 +0200
> From: Christophe Thiebaud <cthiebaud@stylo.it>
> Subject: Re: focus
> To: struts-user@jakarta.apache.org
> Send reply to: struts-user@jakarta.apache.org
>
> [ Double-click this line for list subscription options ]
>
> 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

--
====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat



Mime
View raw message