Commit 61c69bda 61c69bda24e9cfc4ac39ee9c72f1e6cf554a3de0 by Nicolas Perriault

Merge pull request #20 from cbenz/cbenz

Handle multiple values for checkboxes.
2 parents b025ea98 af1e3dc0
Showing 1 changed file with 14 additions and 0 deletions
......@@ -1187,7 +1187,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 {
......