aspose file tools*
The moose likes Struts and the fly likes Struts2 form input tag's cssErrorClass is not being rendered for server side validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 form input tag Watch "Struts2 form input tag New topic
Author

Struts2 form input tag's cssErrorClass is not being rendered for server side validation

J Livermore
Greenhorn

Joined: Nov 22, 2011
Posts: 5
I have a Struts2 input form tag defined as:

<s:radio name="jointAccount" list="#{'yes':'yes','no':'no'}" required="true" cssErrorClass="fv_error"/>

And when I do server side validation in my ActionClass:

if(jointAccount == null || jointAccount.isEmpty()) {
this.addFieldError("jointAccount", "JOINT is required.");
return INPUT;
}

The rendered form element does not have the cssErrorClass:

<input type="radio" name="jointAccount" id="step2_jointAccountyes" value="yes"/><label for="step2_jointAccountyes">yes</label>
<input type="radio" name="jointAccount" id="step2_jointAccountno" value="no"/><label for="step2_jointAccountno">no</label>

I've even tried writing a custom Validator by extending ValidatorSupport, adding the class as a new validator entry in validators.xml and then using that custom validator in the ActionClassName-validation.xml file, and still cannot get the cssErrorClass to render upon a validation error.

Any thoughts?
J Livermore
Greenhorn

Joined: Nov 22, 2011
Posts: 5
This has been fixed for Release 2.3.1 - Jira WW-3712
J Livermore
Greenhorn

Joined: Nov 22, 2011
Posts: 5
For those looking for a work around here is an example:

 
jQuery in Action, 2nd edition
 
subject: Struts2 form input tag's cssErrorClass is not being rendered for server side validation