Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
This issue depends on the following issue: https://issues.apache.org/jira/browse/VALIDATOR-265
As I want to use the errorStyle attribute for the text tag I wrote my own TextTag class and enhanced it with the two variables nameprefix and nameproperty. If both exist i build the name with concatenating the two values, otherwise i call the prepareName() method.
<pc:text errorStyle="..." errorKey="..." name="name" property="mobile" nameprefix="sms_" nameproperty="email" />
protected String prepareNamePlusPrefix() throws JspException {
String res = null;
if (this.nameprefix == null || 0 == this.nameprefix.trim().length())
else {
res = this.nameprefix.trim();
if (this.nameproperty != null)
else
{ res += super.prepareName(); } }
return res;
}
When validation fails and I add an Error with property "sms_email" this property also has to be checked in the doErrosExist() method:
protected boolean doErrorsExist() throws JspException {
boolean errorsExist = false;
if ((getErrorStyleId() != null) || (getErrorStyle() != null) || (getErrorStyleClass() != null)) {
if (this.nameprefix == null || 0 == this.nameprefix.trim().length())
String actualName = prepareNamePlusPrefix();
if (actualName != null)
{ ActionMessages errors = TagUtils.getInstance().getActionMessages(pageContext, GUIConstants.ERRORS_KEY + GUIConstants.PREV); errorsExist = ((errors != null) && (errors.size(actualName) > 0)); } }
return errorsExist;
}