You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Jeremy Mikola (JIRA)" <ji...@apache.org> on 2007/08/10 17:55:18 UTC

[jira] Created: (WW-2103) Invalid Javascript generated for StringLength validator

Invalid Javascript generated for StringLength validator 
--------------------------------------------------------

                 Key: WW-2103
                 URL: https://issues.apache.org/struts/browse/WW-2103
             Project: Struts 2
          Issue Type: Bug
    Affects Versions: 2.0.9
         Environment: NetBeans IDE 5.5.1 (Bundled Tomcat 5.5.17), Java 1.6
            Reporter: Jeremy Mikola
            Priority: Minor


I am attempting to use the StringLength validator for an action's "save" alias, to ensure that a text-field input is between 3 and 1024 characters long (the minLength and maxLength params, respectively).  When testing the validation, I noticed that strings of any length were being rejected by the client-side Javascript validation (I am using the xhtml theme).  Looking at the generated Javascript code in the page source, it appears the problem is that my maxLength parameter is being printed with locale formatting (as it is in when substituted into my error message), rather than as a raw number:

    if(value.length > 0 && (
            (3 > -1 && value.length < 3) ||
            (1,024 > -1 && value.length > 1,024)
            )) {
        addError(field, error);
        errors = true;
    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2103) Invalid Javascript generated for StringLength validator

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2103?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Holmes updated WW-2103:
-----------------------------

    Fix Version/s: 2.0.10
         Assignee: James Holmes

> Invalid Javascript generated for StringLength validator 
> --------------------------------------------------------
>
>                 Key: WW-2103
>                 URL: https://issues.apache.org/struts/browse/WW-2103
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.9
>         Environment: NetBeans IDE 5.5.1 (Bundled Tomcat 5.5.17), Java 1.6
>            Reporter: Jeremy Mikola
>            Assignee: James Holmes
>            Priority: Minor
>             Fix For: 2.0.10
>
>         Attachments: form-close-validate.ftl.patch, struts2-form-close-validate.ftl.patch
>
>
> I am attempting to use the StringLength validator for an action's "save" alias, to ensure that a text-field input is between 3 and 1024 characters long (the minLength and maxLength params, respectively).  When testing the validation, I noticed that strings of any length were being rejected by the client-side Javascript validation (I am using the xhtml theme).  Looking at the generated Javascript code in the page source, it appears the problem is that my maxLength parameter is being printed with locale formatting (as it is in when substituted into my error message), rather than as a raw number:
>     if(value.length > 0 && (
>             (3 > -1 && value.length < 3) ||
>             (1,024 > -1 && value.length > 1,024)
>             )) {
>         addError(field, error);
>         errors = true;
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WW-2103) Invalid Javascript generated for StringLength validator

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2103?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Holmes resolved WW-2103.
------------------------------

    Resolution: Fixed

Many thanks for the patch. Keep 'em coming!

Fixed on the 2_0_X branch in SVN revision 566209.

Fixed on the trunk (Struts 2.1) in SVN revision 566210.

> Invalid Javascript generated for StringLength validator 
> --------------------------------------------------------
>
>                 Key: WW-2103
>                 URL: https://issues.apache.org/struts/browse/WW-2103
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.9
>         Environment: NetBeans IDE 5.5.1 (Bundled Tomcat 5.5.17), Java 1.6
>            Reporter: Jeremy Mikola
>            Assignee: James Holmes
>            Priority: Minor
>             Fix For: 2.0.10
>
>         Attachments: form-close-validate.ftl.patch, struts2-form-close-validate.ftl.patch
>
>
> I am attempting to use the StringLength validator for an action's "save" alias, to ensure that a text-field input is between 3 and 1024 characters long (the minLength and maxLength params, respectively).  When testing the validation, I noticed that strings of any length were being rejected by the client-side Javascript validation (I am using the xhtml theme).  Looking at the generated Javascript code in the page source, it appears the problem is that my maxLength parameter is being printed with locale formatting (as it is in when substituted into my error message), rather than as a raw number:
>     if(value.length > 0 && (
>             (3 > -1 && value.length < 3) ||
>             (1,024 > -1 && value.length > 1,024)
>             )) {
>         addError(field, error);
>         errors = true;
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2103) Invalid Javascript generated for StringLength validator

Posted by "Florent Ramière (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2103?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Florent Ramière updated WW-2103:
--------------------------------

    Attachment: struts2-form-close-validate.ftl.patch

I created a patch using my own svn repository, struts2-form-close-validate.ftl.patch is the patch against the apache svn.
Please disregard form-close-validate.ftl.patch

> Invalid Javascript generated for StringLength validator 
> --------------------------------------------------------
>
>                 Key: WW-2103
>                 URL: https://issues.apache.org/struts/browse/WW-2103
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.9
>         Environment: NetBeans IDE 5.5.1 (Bundled Tomcat 5.5.17), Java 1.6
>            Reporter: Jeremy Mikola
>            Priority: Minor
>         Attachments: form-close-validate.ftl.patch, struts2-form-close-validate.ftl.patch
>
>
> I am attempting to use the StringLength validator for an action's "save" alias, to ensure that a text-field input is between 3 and 1024 characters long (the minLength and maxLength params, respectively).  When testing the validation, I noticed that strings of any length were being rejected by the client-side Javascript validation (I am using the xhtml theme).  Looking at the generated Javascript code in the page source, it appears the problem is that my maxLength parameter is being printed with locale formatting (as it is in when substituted into my error message), rather than as a raw number:
>     if(value.length > 0 && (
>             (3 > -1 && value.length < 3) ||
>             (1,024 > -1 && value.length > 1,024)
>             )) {
>         addError(field, error);
>         errors = true;
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2103) Invalid Javascript generated for StringLength validator

Posted by "Florent Ramière (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2103?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Florent Ramière updated WW-2103:
--------------------------------

    Attachment: form-close-validate.ftl.patch

I confirm the bug, this error was scattered across the validation.
Freemarker ouputs number in the default local by default, in order to have javascript compliant number we need to request the string value using the ?string built-in method.
Note that I fixed also a bug in the stringlength method where the validator was not triggered when the field value is empty

> Invalid Javascript generated for StringLength validator 
> --------------------------------------------------------
>
>                 Key: WW-2103
>                 URL: https://issues.apache.org/struts/browse/WW-2103
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.9
>         Environment: NetBeans IDE 5.5.1 (Bundled Tomcat 5.5.17), Java 1.6
>            Reporter: Jeremy Mikola
>            Priority: Minor
>         Attachments: form-close-validate.ftl.patch
>
>
> I am attempting to use the StringLength validator for an action's "save" alias, to ensure that a text-field input is between 3 and 1024 characters long (the minLength and maxLength params, respectively).  When testing the validation, I noticed that strings of any length were being rejected by the client-side Javascript validation (I am using the xhtml theme).  Looking at the generated Javascript code in the page source, it appears the problem is that my maxLength parameter is being printed with locale formatting (as it is in when substituted into my error message), rather than as a raw number:
>     if(value.length > 0 && (
>             (3 > -1 && value.length < 3) ||
>             (1,024 > -1 && value.length > 1,024)
>             )) {
>         addError(field, error);
>         errors = true;
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.