backbone.stickit
backbone.stickit copied to clipboard
Deselecting multpile checkboxes don't run validation.
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/