Theres a couple of outstanding enhancement requests in bugzilla which talk
about a label tag:

http://issues.apache.org/bugzilla/show_bug.cgi?id=20784
http://issues.apache.org/bugzilla/show_bug.cgi?id=18015

Niall


----- Original Message ----- 
From: "Joe Germuska" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Monday, November 08, 2004 10:08 PM
Subject: Re: Display message beside input field using struts validator


> At 3:49 PM -0600 11/8/04, Struts User wrote:
> >Hello,
> >
> >Currently, I am using struts validator to validate the fields in my
> >ActionForm.
> >
> >Before I updated to struts 1.2.4, I could add an error this way -
errors.add(
> >"username", new ActionError("error.username.required"));
> >
> >If the validation failed, the error message for username will be
> >displayed right beside the user name text field if I use <P>Username:
> ><html:text property="username"/></P>.
> >
> >Can someone tell me how to display error message beside an input field
> >using struts validator?
>
> I've never seen any automatic message placement.  You can access
> messages like this:
>
> <html:messages property="username" id="msg"></html:messages>
>
> html:messages is effectively a combination logic/iterator tag.  If
> there are any "username" messages in the ActionMessages object saved
> as the "errors" messages, the body of html:messages will be evaluated
> once for each, with a scripting variable of type String defined with
> the name specified in the "id" attribute.  You can use c:out or
> bean:write to display this value, wrapped with span, div, or other
> tags which format your messages correctly.
>
> I kind of think someone talked on the list once about making
> something which rendered an HTML "label" tag and which was also
> "smart" about the presence of errors.  I like the idea of something
> like that in general, but wonder if you'd be able to specify
> something suitably general for inclusion in Struts.  Seems like it
> might be better left for local development.
>
> Joe



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to