backbone.stickit icon indicating copy to clipboard operation
backbone.stickit copied to clipboard

Deselecting multpile checkboxes don't run validation.

Open webskydavid opened this issue 7 years ago • 0 comments

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/

webskydavid avatar May 19 '17 14:05 webskydavid