• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
J Livermore
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has been fixed for Release 2.3.1 - Jira WW-3712
 
J Livermore
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For those looking for a work around here is an example:

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic