From 727fb61bcb5a5c7a3dbd07dc5ce0d7dac9b71055 Mon Sep 17 00:00:00 2001 From: "andre.peters" Date: Fri, 12 Jan 2018 08:30:54 +0100 Subject: [PATCH] [Web] Fixes number validation in forms, fixes #882 --- data/web/js/api.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/data/web/js/api.js b/data/web/js/api.js index f0a0e0b6..2308a595 100644 --- a/data/web/js/api.js +++ b/data/web/js/api.js @@ -91,12 +91,12 @@ $(document).ready(function() { } } if ($(this).attr("max")) { - if ($(this).val() > $(this).attr("max")) { + if (Number($(this).val()) > Number($(this).attr("max"))) { invalid = true; $(this).addClass('inputMissingAttr'); } else { if ($(this).attr("min")) { - if ($(this).val() < $(this).attr("min")) { + if (Number($(this).val()) < Number($(this).attr("min"))) { invalid = true; $(this).addClass('inputMissingAttr'); } else { @@ -175,12 +175,13 @@ $(document).ready(function() { } } if ($(this).attr("max")) { - if ($(this).val() > $(this).attr("max")) { + if (Number($(this).val()) > Number($(this).attr("max"))) { + alert($(this).attr("max")) invalid = true; $(this).addClass('inputMissingAttr'); } else { if ($(this).attr("min")) { - if ($(this).val() < $(this).attr("min")) { + if (Number($(this).val()) < Number($(this).attr("min"))) { invalid = true; $(this).addClass('inputMissingAttr'); } else {