Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/css/brutusin-json-forms.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ form.brutusin-form table, form.brutusin-form input, form.brutusin-form select, f
min-width: 80px;
}

form.brutusin-form input[type=radio] {
form.brutusin-form input[type=radio], form.brutusin-form input[type=checkbox] {
margin: 0 15px 0 10px;
}

Expand Down
22 changes: 22 additions & 0 deletions src/js/brutusin-json-forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,28 @@ if (typeof brutusin === "undefined") {
appendChild(input, radioInput, s);
}
}
else if (s.format === "checkbox") {
input = document.createElement("div");
for (var i = 0; i < s.enum.length; i++) {
checkbox = document.createElement("input");
checkbox.type = "checkbox";
checkbox.name = s.enum[i];
checkbox.value = s.enum[i];

var label = document.createElement("label");
label.htmlFor = s.enum[i];
var labelText = document.createTextNode(s.enum[i]);
appendChild(label, labelText);
if (value && s.enum[i] === value) {
checkbox.checked = true;
}
if (s.readOnly) {
checkbox.disabled = true;
}
appendChild(input, label);
appendChild(input, checkbox, s);
}
}
else if (s.required) {
input = document.createElement("input");
input.type = "checkbox";
Expand Down