Skip to content

Deselecting multpile checkboxes don't run validation. #317

@webskydavid

Description

@webskydavid

Hi.
I have multiple checkboxes, if I press submit it show me validation errors. After pressing one of them the validation error disapperars.
The values if one checkbox is pressed looks like this:
["30"]
After deselecting all checkboxes looks like this:
[] <- thats wrong, the value need to be empty.
The validation works only if I add onSet function to binding:

'input.usr:checkbox': {
      observe   : 'usr',
      onSet: function (value) {
        if(value.length > 0){
          return value;
        }
        return '';
      },
      setOptions: {
        validate: true
      }
    }

Example: http://jsfiddle.net/c3kK2/474/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions