Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-1419

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

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.0
    • Component/s: Plugin - Tags
    • Labels:
      None

      Description

      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; }

        Attachments

          Activity

            People

            • Assignee:
              mrdon Donald J. Brown
              Reporter:
              user497 Josh Foure
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: