John,

Thanks for your reply.

As you've described the solution, it sounds like it would also put the 
message(s) beside the field in error.  What I'm looking for is to keep the 
messages at the top of the page (like standard html:errors tag does) and 
within the body of the form include just a single image before each field in 
error, simply to use as an indicator.

Thanks,
Michelle


>From: John Yu <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: Re: Showing image beside fields with errors
>Date: Wed, 24 Oct 2001 16:30:17 +0800
>
>Michelle,
>
>Regarding #1, you use the 'property' attribute of the ActionError to
>associate the error with the problematic field. In your validation code:
>
>     if((form.getName() == null) || form.getName().equals("")) {
>       // Name can't be empty. Report the problem.
>       ActionErrors errors = new ActionErrors();
>       errors.add("name", new ActionError("error.nameEmtpy"));
>       saveErrors(request, errors);
>       return new ActionMapping(mapping.getInput());
>     }
>
>In the JSP,
>
>   <table width="75%" border="0">
>     <tr>
>       <td width="35%">
>         <div align="left">Name:</div>
>       </td>
>       <td width="65%">
>         <html:text property="name" />
>         <html:errors property="name" />
>        </td>
>     </tr>
>     ....
>
>
>To include an image, in your resource bundle,
>
>   error.nameEmtpy=Name cannot be empty
>   errors.header=<img src="arrow.gif"><font color="red">
>   errors.footer=</font>
>
>--
>John
>
>
>At 09:56 pm 23-10-2001 -0400, you wrote:
>>Hi,
>>
>>A couple things that I would like to do with the Struts 1.0 release
>>relating to errors that I can't see doing without writing a bunch of extra
>>code.
>>
>>1)  When I have validation errors (ActionErrors) I would like to show an
>>image (red arrow gif) next to the fields that are in error.
>>2) I would also, like to have the list of error messages to be hyperlinked
>>so that they take the focus directly to the field in error when clicked.
>>
>>Has anyone been able to do this?
>>Any ideas? Sample code?
>>
>>Thanks,
>>Michelle
>>[EMAIL PROTECTED]
>
>--
>John Yu                       Scioworks Technologies
>e: [EMAIL PROTECTED]         w: +(65) 873 5989
>w: http://www.scioworks.com m: +(65) 9782 9610
>
>Scioworks Camino - "Rapid WebApp Assembly for Struts"


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

Reply via email to