Commit f22b8ad4 authored by Boris Kocherov's avatar Boris Kocherov

use boolean data-json-type for ability use `true`/`false` value as string

parent dbaf4a54
...@@ -86,6 +86,7 @@ ...@@ -86,6 +86,7 @@
schema_for_selection.default = schema.default; schema_for_selection.default = schema.default;
} }
input = render_selection(schema_for_selection, json_document); input = render_selection(schema_for_selection, json_document);
input.setAttribute('data-json-type', "boolean");
return input; return input;
} }
...@@ -1092,12 +1093,15 @@ ...@@ -1092,12 +1093,15 @@
k; k;
g.props.inputs.forEach(function (input) { g.props.inputs.forEach(function (input) {
if (input.required || input.value !== "") { if (input.required || input.value !== "") {
var type = input.getAttribute('data-json-type');
if (input.type === 'number') { if (input.type === 'number') {
json_dict[input.name] = parseInt(input.value, 10); json_dict[input.name] = parseInt(input.value, 10);
} else if (input.value === "true") { } else if (type === "boolean") {
json_dict[input.name] = true; if (input.value === "true") {
} else if (input.value === "false") { json_dict[input.name] = true;
json_dict[input.name] = false; } else if (input.value === "false") {
json_dict[input.name] = false;
}
} else if (input.tagName === "TEXTAREA") { } else if (input.tagName === "TEXTAREA") {
if (input["data-format"] === "string") { if (input["data-format"] === "string") {
json_dict[input.name] = input.value; json_dict[input.name] = input.value;
......
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