You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Josh Foure (JIRA)" <ji...@apache.org> on 2006/08/28 20:39:32 UTC

[jira] Created: (WW-1419) xhtml form-close-validate.ftl template has incorrect regex validation

xhtml form-close-validate.ftl template has incorrect regex validation
---------------------------------------------------------------------

                 Key: WW-1419
                 URL: http://issues.apache.org/struts/browse/WW-1419
             Project: Struts 2
          Issue Type: Bug
          Components: Views
    Affects Versions: 2.0.0
            Reporter: Josh Foure


In the template/xhtml/form-close-validate.ftl template, this is the code for the regex validation:

            if (field.value != null && !field.value.match("${validator.expression?js_string}")==null) {
                addError(field, error);
                errors = true;
            }

Either the exclamation point in front of "field.value.match(...)" should be removed or the "==null" after the match call should be removed.  The problem with having the "!" and the "==null" is that the left side will evaluate to a boolean but any boolean compared to null is false.

This is what the code looks like in WebWorks 2.2.3 (they don't have the "==null"):

            if (field.value != null && !field.value.match("${validator.expression?js_string}")) {
                addError(field, error);
                errors = true;
            }


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (WW-1419) xhtml form-close-validate.ftl template has incorrect regex validation

Posted by "Josh Foure (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/struts/browse/WW-1419?page=all ]

Josh Foure updated WW-1419:
---------------------------

    Priority: Minor  (was: Major)

> xhtml form-close-validate.ftl template has incorrect regex validation
> ---------------------------------------------------------------------
>
>                 Key: WW-1419
>                 URL: http://issues.apache.org/struts/browse/WW-1419
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Views
>    Affects Versions: 2.0.0
>            Reporter: Josh Foure
>            Priority: Minor
>
> In the template/xhtml/form-close-validate.ftl template, this is the code for the regex validation:
>             if (field.value != null && !field.value.match("${validator.expression?js_string}")==null) {
>                 addError(field, error);
>                 errors = true;
>             }
> Either the exclamation point in front of "field.value.match(...)" should be removed or the "==null" after the match call should be removed.  The problem with having the "!" and the "==null" is that the left side will evaluate to a boolean but any boolean compared to null is false.
> This is what the code looks like in WebWorks 2.2.3 (they don't have the "==null"):
>             if (field.value != null && !field.value.match("${validator.expression?js_string}")) {
>                 addError(field, error);
>                 errors = true;
>             }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (WW-1419) xhtml form-close-validate.ftl template has incorrect regex validation

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/struts/browse/WW-1419?page=all ]

Don Brown resolved WW-1419.
---------------------------

    Fix Version/s: 2.0.0
       Resolution: Fixed
         Assignee: Don Brown

Fixed, thanks for the patch!

> xhtml form-close-validate.ftl template has incorrect regex validation
> ---------------------------------------------------------------------
>
>                 Key: WW-1419
>                 URL: http://issues.apache.org/struts/browse/WW-1419
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Views
>            Reporter: Josh Foure
>         Assigned To: Don Brown
>            Priority: Minor
>             Fix For: 2.0.0
>
>
> In the template/xhtml/form-close-validate.ftl template, this is the code for the regex validation:
>             if (field.value != null && !field.value.match("${validator.expression?js_string}")==null) {
>                 addError(field, error);
>                 errors = true;
>             }
> Either the exclamation point in front of "field.value.match(...)" should be removed or the "==null" after the match call should be removed.  The problem with having the "!" and the "==null" is that the left side will evaluate to a boolean but any boolean compared to null is false.
> This is what the code looks like in WebWorks 2.2.3 (they don't have the "==null"):
>             if (field.value != null && !field.value.match("${validator.expression?js_string}")) {
>                 addError(field, error);
>                 errors = true;
>             }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (WW-1419) xhtml form-close-validate.ftl template has incorrect regex validation

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/struts/browse/WW-1419?page=all ]

Don Brown updated WW-1419:
--------------------------

    Affects Version/s:     (was: 2.0.0)

> xhtml form-close-validate.ftl template has incorrect regex validation
> ---------------------------------------------------------------------
>
>                 Key: WW-1419
>                 URL: http://issues.apache.org/struts/browse/WW-1419
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Views
>            Reporter: Josh Foure
>         Assigned To: Don Brown
>            Priority: Minor
>             Fix For: 2.0.0
>
>
> In the template/xhtml/form-close-validate.ftl template, this is the code for the regex validation:
>             if (field.value != null && !field.value.match("${validator.expression?js_string}")==null) {
>                 addError(field, error);
>                 errors = true;
>             }
> Either the exclamation point in front of "field.value.match(...)" should be removed or the "==null" after the match call should be removed.  The problem with having the "!" and the "==null" is that the left side will evaluate to a boolean but any boolean compared to null is false.
> This is what the code looks like in WebWorks 2.2.3 (they don't have the "==null"):
>             if (field.value != null && !field.value.match("${validator.expression?js_string}")) {
>                 addError(field, error);
>                 errors = true;
>             }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira