Since this is essentially error text you are talking about, I think the
easiest way to handle this is through Struts's error tags:

<html:text property="username" ... /> <html:errors property="username"/>

Where there is an error on "username," you add a new ActionError with a
message key like "error.field.icon" or something, and the value of that key
is just HTML that generates the icon.

So you would have this in your ApplicationResources.properties file:

error.field.icon=<img src="error_icon.gif" />

The drawback then is that you really can't add any other errors on
"username" or else the display would mess up.

We used this approach on a project and it worked well.


Sean


----- Original Message -----
From: "Angela Saval" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, December 02, 2001 8:06 PM
Subject: Icons next to form elements with validation errors


> I would like to be able to place an icon next to each field in a form that
> did not validate correctly.  Is this integrated into the html input fields
> tags some how?  If so, I am not seeing this.  For example, I would like
> something like
>
> <html:text property="username" size="20" maxlength="100"
> erroricon="/images/error.jpg"/>
>
> The only way that I see of doing something like this now is to extend each
> of the html tag definitions to include an error icon attribute since I see
> no way to extend a tag definition.
>
> Any insight on how others have solved this problem would be appreciated.
>
> Angela
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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

Reply via email to