Commit 26024012 authored by Boris Kocherov's avatar Boris Kocherov

change type of number field on user input so user can be view original wrong value

parent a6bc0bae
...@@ -807,13 +807,14 @@ ...@@ -807,13 +807,14 @@
if (default_value === undefined && typeof json_field.default === "number") { if (default_value === undefined && typeof json_field.default === "number") {
input.value = json_field.default; input.value = json_field.default;
} }
input.type = "number";
input.setAttribute("data-json-type", type); input.setAttribute("data-json-type", type);
type_changed = default_value !== undefined && if (default_value === undefined || default_value === null ||
typeof default_value !== "number"; typeof default_value === "number") {
input.type = "number";
}
if (type === "integer") { if (type === "integer") {
input.setAttribute("step", "1"); input.setAttribute("step", "1");
if (default_value !== undefined && if (typeof default_value === "number" &&
parseInt(default_value, 10) !== default_value) { parseInt(default_value, 10) !== default_value) {
// original json_document contain float schema // original json_document contain float schema
// limit integer we can save original document // limit integer we can save original document
...@@ -1709,6 +1710,12 @@ ...@@ -1709,6 +1710,12 @@
if (input.hasAttribute('data-origin-value')) { if (input.hasAttribute('data-origin-value')) {
input.removeAttribute('data-origin-value'); input.removeAttribute('data-origin-value');
} }
if (!input.hasAttribute("type")) {
if (["integer", "number"]
.indexOf(input.getAttribute('data-json-type')) >= 0) {
input.type = "number";
}
}
changed = true; changed = 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