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

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

      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?

        Acceptance criteria

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

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD