Commit 634da093 authored by Boris Kocherov's avatar Boris Kocherov

use parseFloat for number type

parent d201e83c
...@@ -668,6 +668,13 @@ ...@@ -668,6 +668,13 @@
input.value = json_field.default; input.value = json_field.default;
} }
input.type = "number"; input.type = "number";
input.setAttribute("data-json-type", type);
if (type === "integer") {
input.setAttribute("step", "1");
}
if (type === "number") {
input.setAttribute("step", "any");
}
} else { } else {
if (default_value === undefined && typeof json_field.default === "string") { if (default_value === undefined && typeof json_field.default === "string") {
input.value = json_field.default; input.value = json_field.default;
...@@ -1094,7 +1101,9 @@ ...@@ -1094,7 +1101,9 @@
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'); var type = input.getAttribute('data-json-type');
if (input.type === 'number') { if (type === 'number') {
json_dict[input.name] = parseFloat(input.value);
} else if (type === "integer") {
json_dict[input.name] = parseInt(input.value, 10); json_dict[input.name] = parseInt(input.value, 10);
} else if (type === "boolean") { } else if (type === "boolean") {
if (input.value === "true") { if (input.value === "true") {
......
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