[
https://issues.apache.org/struts/browse/WW-1799?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mads Riise Rasmussen updated WW-1799:
-------------------------------------
Correction to the patch (check is moved to after trim):
<#elseif validator.validatorType = "stringlength">
if (field.value != null) {
var value = field.value;
<#if validator.trim>
//trim field value
while (value.substring(0,1) == ' ')
value = value.substring(1, value.length);
while (value.substring(value.length-1, value.length) == ' ')
value = value.substring(0, value.length-1);
</#if>
if(value.length > 0 && (
(${validator.minLength} > -1 && value.length <
${validator.minLength}) ||
(${validator.maxLength} > -1 && value.length >
${validator.maxLength})
)) {
addError(field, error);
errors = true;
}
}
> StringLength validator is inconsistent client side and server side
> ------------------------------------------------------------------
>
> Key: WW-1799
> URL: https://issues.apache.org/struts/browse/WW-1799
> Project: Struts 2
> Issue Type: Bug
> Components: Actions
> Affects Versions: 2.0.6
> Reporter: Mads Riise Rasmussen
> Priority: Minor
>
> There is an issue with the StringLengthValidator when you submit a blank text
> field when haven't specified the RequiredStringValidator. Client side the
> StringLengthValidator is validating (wrong way), Server side it is not
> validating (right way). It's quite obvious when looking in the generated
> client side src code.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.