Commit af1e3dc0 af1e3dc054b8e42fce96ebe3d9cc5a94e093998e by Christophe Benz

Handle multiple values for checkboxes.

1 parent 4dd4b736
Showing 1 changed file with 14 additions and 0 deletions
......@@ -1186,7 +1186,21 @@
field.value = value;
break;
case "checkbox":
if (fields) {
var values = value;
if (!Array.isArray(values)) {
values = [values];
}
Array.prototype.forEach.call(fields, function(e) {
if (values.indexOf(e.value) !== -1) {
e.setAttribute('checked', 'checked');
} else {
e.removeAttribute('checked');
}
});
} else {
field.setAttribute('checked', value ? "checked" : "");
}
break;
case "file":
throw {
......