Uploaded image for project: 'Magnolia UI'
  1. Magnolia UI
  2. MGNLUI-7019

Validators don't validate the value which will be stored (empty string vs null)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Neutral
    • None
    • 6.2.15
    • app framework
    • None

    Description

      Steps to reproduce

      1.  Define a field like so:
       twitter:
                required: false
                $type: textField
                validators:
                  - name: regexp
                    pattern: '[a-zA-Z0-9_]{1,15}'
                    $type: regexpValidator
      

      Fill in the empty string. The field is not required. It will not validate.

      If I remove the validator, it will store, but not fill in the field. The empty string is interpreted as null.

      But the regexpvalidator would have accepted null too.

       

      This particular case can be easily worked around. But how about $type: emailValidator?

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                Unassigned Unassigned
                mihxil Michiel Meeuwissen
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Bug DoR
                    Task DoD