Hi,
It would be better to do it in the ActionBean.
By doing something like the following, the global error message is
displayed for the stripes:errors tag and the 'year' and the 'month'
labels are rendered with 'error' css classes.
if (isInvalid(date)) {
ValidationErrors errors = getContext().getErrors();
SimpleError emptyError = new SimpleError("");
errors.addGlobalError(new SimpleError("Invalid date"));
errors.add("year", emptyError);
errors.add("month", emptyError);
}
Regards,
Iwao
2011/11/15 fatefree <[email protected]>:
>
> I have a situation where I am validating a credit card expiration date, which
> is inputted as two drop down list containing months and years. If the month
> or year is null, I can use the stripes error tag to highlight those labels
> indicating to the user that they forgot to select them.
>
> But if the date is invalid (expired perhaps), I have to generate an error
> message that doesn't exactly map to a field. Ideally I would like both the
> month and year label to have a css class indicating an error. Is there any
> way in the jsp to determine if an error message key is found, and then
> perhaps manually change the css myself for those labels?
> --
> View this message in context:
> http://old.nabble.com/Is-there-a-way-to-determine-if-a-specific-error-message-exists-in-s%3Aerrors--tp32841046p32841046.html
> Sent from the stripes-users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users