struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mads Riise Rasmussen (JIRA)" <j...@apache.org>
Subject [jira] Updated: (WW-1799) StringLength validator is inconsistent client side and server side
Date Mon, 12 Mar 2007 09:19:51 GMT

     [ https://issues.apache.org/struts/browse/WW-1799?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Mads Riise Rasmussen updated WW-1799:
-------------------------------------


Patch (for file /template/xhtml/form-close-validate.ftl -  "&& field.value.length
> 0" is added in second line):

<#elseif validator.validatorType = "stringlength">
            if (field.value != null && field.value.length > 0) {
                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((${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.


Mime
View raw message