Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if field generated error

I can display errors for specific fields using this tag:

<s:fielderror fieldName="myField" />

But in addition to displaying the error message I would like to highlight the field in red. To do this I need to know if a field generated an error, and then add error class to this field.

How can I check if specific field has generated an error?

like image 494
Eleeist Avatar asked Oct 23 '12 17:10

Eleeist


1 Answers

Errors for fields are stored in fieldErrors map. So you can check for specific field error in <s:if> tag like that

<s:if test="fieldErrors.containsKey('fieldName')">
like image 169
Aleksandr M Avatar answered Nov 05 '22 00:11

Aleksandr M