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 Fri, 22 Sep 2000 08:35:41 GMT
as a corollary to the input focus, I would like to implement another
fairly common feature : the prompt of the incorrect input field is marked to
enhance its visibility, either by changing its color or by adding a red asterisk.

I already use the <struts:message> tag to produce the text in the html

I also use style sheets.

Again, I cannot find a simple solution outside of writing my own tag.

any suggestions ?

Christophe

On Tue, 19 Sep 2000, you wrote:
> 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
> 
> 
> > 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