Uploaded image for project: 'PUBLIC - Liferay Alloy UI'
  1. PUBLIC - Liferay Alloy UI
  2. AUI-669

Form Validator improperly registers fields with the RULES key anywhere in the class name

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0.2, 1.5.0
    • Fix Version/s: 1.5.1, 1.6.0
    • Component/s: Form - JS (deprecated)
    • Labels:
      None

      Description

      In FormValidator, we are trying to parse the regex to look for any fields that contains the CSS class of aui-field-date or aui-field-required, etc. However, the regex is wrong, so it's picking up fields that have the keys anywhere in the CSS class. For instance, anything with date will be validated as a date, anything with required will be validated as required, etc.

      Currently it's this:
      var regex = getRegExp('aui-field-' + defaultRulesJoin, 'g');
      which translates to
      /aui-field-acceptFiles|date|equalTo|max|maxLength|min|minLength|range|rangeLength|required|alpha|alphanum|digits|number|email|url/g

      but it should be:
      var regex = getRegExp('aui-field-(' + defaultRulesJoin + ')', 'g');
      so that it would translate to:
      /aui-field-(acceptFiles|date|equalTo|max|maxLength|min|minLength|range|rangeLength|required|alpha|alphanum|digits|number|email|url)/g

        Attachments

          Activity

            People

            Assignee:
            nathan.cavanaugh Nate Cavanaugh
            Reporter:
            nathan.cavanaugh Nate Cavanaugh
            Participants of an Issue:
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              9 years, 3 weeks, 6 days ago

                Packages

                Version Package
                1.5.1
                1.6.0