Author: husted Date: Mon Mar 19 19:45:07 2007 New Revision: 520235 URL: http://svn.apache.org/viewvc?view=rev&rev=520235 Log: WW-1799 "StringLength validator is inconsistent client side and server side" submitted by Mads Riise Rasmussen
Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/template/xhtml/form-close-validate.ftl Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/template/xhtml/form-close-validate.ftl URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/template/xhtml/form-close-validate.ftl?view=diff&rev=520235&r1=520234&r2=520235 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/template/xhtml/form-close-validate.ftl (original) +++ struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/template/xhtml/form-close-validate.ftl Mon Mar 19 19:45:07 2007 @@ -46,12 +46,14 @@ while (value.substring(value.length-1, value.length) == ' ') value = value.substring(0, value.length-1); </#if> - if((${validator.minLength} > -1 && value.length < ${validator.minLength}) || - (${validator.maxLength} > -1 && value.length > ${validator.maxLength})) { + if(value.length > 0 && ( + (${validator.minLength} > -1 && value.length < ${validator.minLength}) || + (${validator.maxLength} > -1 && value.length > ${validator.maxLength}) + )) { addError(field, error); errors = true; } - } + } <#elseif validator.validatorType = "regex"> if (field.value != null && !field.value.match("${validator.expression?js_string}")) { addError(field, error);