Thanks Niall.

Now, what I need is to change the style of the prompt text beside the field, not the field itself, or else perhaps the td that houses both the prompt and the input. But, you have given me an idea . . . Perhaps I could extend the bean:message tag to act in a similar way? I would appreciate knowing if you think that is sensible.

I'll check out the bug report.

Thanks,
Erik



Niall Pemberton wrote:

Theres an open bugzilla ticket requesting this kind of feature:

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

Haven't really had time to look at it, but it has patches attached.

I also posted an extension to the <html:text> tag on my web site which
highlights error fields.

http://www.niallp.pwp.blueyonder.co.uk/#errortag

Niall

----- Original Message ----- From: "Erik Weber" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, July 29, 2004 10:10 AM
Subject: Re: Retrieving specific form validation error messages





This is what I came up with:

<c:set var="foo" value="valueA"/>
<logic:messagesPresent name="org.apache.struts.action.ERROR"
property="currentField">
<c:set var="foo" value="valueB"/>
</logic:messagesPresent>
. . . render the prompt for currentField, placing <c:out
value="${foo}"/> where necessary (this could be a css class or font
color, etc.) , , ,

I am doing this for each field. Please let me know if there is a better


way.


Thanks,
Erik



Erik Weber wrote:



I see that the ActionErrors object is stored as a request attribute
under the key "org.apache.struts.action.ERROR".

I would like to set a different CSS class for each <td> containing a
field that has a property that is keyed in the ActionErrors instance.
In pseudocode:

begin "username" field;
if (ActionErrors instance exists and ActionErrors instance contains
any ActionErrors for the "username" property) {
open td with class set to "style B";
print prompt for username field;
print username field;
close td;
}
else {
open td with class set to "style A";
print prompt for username field;
print username field;
close td;
}

. . . and so on, for each field. This seemingly could get to be a lot
of code. Any Struts/JSTL tag tricks I can use?


Thanks, Erik




Erik Weber wrote:



In a JSP containing a form, what is the easiest way to see if a form
validation error message exists for a particular, say, html:text
field, when that page is processing after form validation has failed?
For example, what if you wanted to present the messages field by
field instead of all together at the top of the page? I assume the
error messages are keyed according to the value of the "property"
attribute for each field, or something similar?

Thanks,
Erik

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




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




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








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





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



Reply via email to