Render decimal field types with number type

This commit is contained in:
Preston Doman 2019-02-26 13:48:51 -08:00
parent 792c3afe7b
commit e4ebd097ec

View file

@ -1,6 +1,6 @@
const reportType = { const reportType = {
NEW : 1, NEW : 1,
EDIT : 2, EDIT : 2
}; };
// Hack to change endpoint url // Hack to change endpoint url
@ -152,14 +152,15 @@ function createFormGroup(sectionIdStr, field) {
formGroup.appendChild(div); formGroup.appendChild(div);
break; break;
case "decimal": case "decimal":
input.type = "text"; input.type = "number";
if (field.value === "0.00") { if (field.value === "0.00") {
input.value = ""; input.value = "";
} else { } else {
input.value = field.value; input.value = field.value;
} }
input.classList.add("form-control"); input.classList.add("form-control");
input.pattern = "\\d+(\\.\\d{2})?"; input.step = 0.01;
input.min = 0.00;
formGroup.appendChild(label); formGroup.appendChild(label);
div.appendChild(input) div.appendChild(input)
formGroup.appendChild(div); formGroup.appendChild(div);