Commit ed436c28 authored by Boris Kocherov's avatar Boris Kocherov

make code better understandable

parent 5a96bd75
......@@ -109,23 +109,23 @@
return schema;
}
function render_selection(json_field, default_value) {
function render_selection(schema, json_document) {
var input = document.createElement("select"),
option = document.createElement("option"),
option_index,
optionz;
input.size = 1;
option.value = "";
if (default_value === undefined) {
if (json_document === undefined) {
option.selected = "selected";
}
input.appendChild(option);
for (option_index in json_field['enum']) {
if (json_field['enum'].hasOwnProperty(option_index)) {
for (option_index in schema['enum']) {
if (schema['enum'].hasOwnProperty(option_index)) {
optionz = document.createElement("option");
optionz.value = json_field['enum'][option_index];
optionz.textContent = json_field['enum'][option_index];
if (json_field['enum'][option_index] === default_value) {
optionz.value = schema['enum'][option_index];
optionz.textContent = schema['enum'][option_index];
if (schema['enum'][option_index] === json_document) {
optionz.selected = "selected";
}
input.appendChild(optionz);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment