struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brown, James" <james.br...@ca.unisys.com>
Subject ActionErrors display
Date Sun, 25 Jan 2004 11:32:31 GMT
Hi,

I have been trying to work through the display of ActionErrors - both global and non-global
(field level) - such that it would look something like the following HTML sample:

<html>
<head><title>Search Form</title></head>
<body>
  <P><strong>The following errors have occurred:</strong></P>
  <UL>
    <LI><i>A global error has been detected</i></LI>
    <LI><i>Last Name is invalid.</i></LI>
  </UL>
  <p>Fields marked with a red background and a <img src="https://scgi.ebay.com/saw/pics/sitewide/warning_9x10.gif"
width="9" height="10" hspace="3" vspace="2" border="0"><font face="Arial, Helvetica,
Verdana, sans-serif" size="2"> have failed validation.</p>
  <form name="search" method="POST" action="search.do">
  <h3>Please provide the following search criteria information.</h3>
  <p>You must complete all of the fields marked with an asterisk <font color="red">(*)</font>.</p>
  <p><font color="red">*</font>Last Name:
    <input style="background: red" type="text" name="lastname" maxlength="25" size="25"
value="Do!" title="Last Name is invalid.">
      <img src="https://scgi.ebay.com/saw/pics/sitewide/warning_9x10.gif" width="9" height="10"
hspace="3" vspace="2" border="0"></p>
  <p><font color="red">*</font>First Name:
    <input type="text" name="firstname" maxlength="25" size="25" value="John"></p>
  <input type="submit" value="Continue">
</body>
</html>

The desire is:
  1. All errors will appear in one place - the top of the page.
  2. Any field for which validation errors have been detected, would be further flagged in
1 of three potential ways:
     a. changing the fields background colour;
     b. marking it with an exclamation icon (thanks to eBay for the quick sample); or
     c. including the error message (in this case "Last Name is invalid.") in the title attribute
of the input.

#1 is easily achieved; however, I have been struggling with #2 in any form.  The html:errors
tag makes it very easy to output the message for a specific field, but I cannot seem to find
a means to use it to "flag" that an error has occurred.

Any suggestions would be greatly appreciated.

                                  Cheers,
                                  James

THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus
for use only by the intended recipient. If you received this in error, please contact the
sender and delete the e-mail and its attachments from all computers. 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message