Commit af1e3dc0 af1e3dc054b8e42fce96ebe3d9cc5a94e093998e by Christophe Benz

Handle multiple values for checkboxes.

1 parent 4dd4b736
Showing 1 changed file with 15 additions and 1 deletions
......@@ -1186,7 +1186,21 @@
field.value = value;
break;
case "checkbox":
field.setAttribute('checked', value ? "checked" : "");
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 {
......