Skip to content

Validation of Multiple Select Failing #470

Open
@otterslide

Description

@otterslide

I tried adding
data-validation="length" data-validation-length="min1" on a select multiple="true" and I get

jquery.form-validator.js:1862 Uncaught TypeError: Cannot read property 'length' of null

I had to add a null check in validatorFunction to make it work. I'm not sure if I'm doing something wrong, I would have assumed this should be working already.. I'm using Chrome, perhaps other browsers return an object when select multiple has nothing selected.

    if(val == null) {
          return false;
      } else {
          // check if length is above min, below max or within range.
          var len = type === 'file' && $el.get(0).files !== undefined ? $el.get(0).files.length : val.length,
            lengthCheckResults = $.formUtils.numericRangeCheck(len, lengthAllowed),
            checkResult;
      }

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions