You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Karr, David" <da...@attws.com> on 2002/10/17 01:45:10 UTC
RE: Error Messaging --> Highlight the title of the form elemen
t to show it is required
Inline.
> -----Original Message-----
> From: Don Najd [mailto:dnajd@leemak.com]
> Sent: Wednesday, October 16, 2002 4:29 PM
> To: struts-list
> Subject: Error Messaging --> Highlight the title of the form
> element to
> show it is required
>
> I validate a jsp form post...
>
> ------------------------ code ----------------------------
> public ActionErrors validate(ActionMapping mapping,
> HttpServletRequest request) {
>
> ActionErrors errors = new ActionErrors();
>
> errors.add(firstName, new ActionError("error.required.firstName"));
> }
> ------------------------ code ----------------------------
>
> returning errors, but I want to highlight the required field
> title on the
> jsp page when it returns with the error message. Is there a
> standard way of
> doing this or a suggested method? I could do an if statement
> on the error
> message, but it is in the AAWResources.properties file and is
> subject to
> change.
I don't see any way to do it today, at least not directly. You might
consider grouping each ActionError creation that needs this functionality
with setting of a form bean value which would be referenced from the "class"
attribute of a "label" or "div" element. You could use that to control the
styling of the label.
There's some considering on the dev list about enhancing the "errors" tag to
get additional functionality to be able to iterate through the errors,
producing your own markup for each error. I'm not very familiar with
javascript arcana, but is it possible for the emitted HTML to cause
execution of a javascript piece which could modify the document?
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>