Browse Source

[Web] Fixes number validation in forms, fixes #882

andre.peters 7 years ago
parent
commit
727fb61bcb
1 changed files with 5 additions and 4 deletions
  1. 5 4
      data/web/js/api.js

+ 5 - 4
data/web/js/api.js

@@ -91,12 +91,12 @@ $(document).ready(function() {
           }
           }
         }
         }
         if ($(this).attr("max")) {
         if ($(this).attr("max")) {
-          if ($(this).val() > $(this).attr("max")) {
+          if (Number($(this).val()) > Number($(this).attr("max"))) {
             invalid = true;
             invalid = true;
             $(this).addClass('inputMissingAttr');
             $(this).addClass('inputMissingAttr');
           } else {
           } else {
             if ($(this).attr("min")) {
             if ($(this).attr("min")) {
-              if ($(this).val() < $(this).attr("min")) {
+              if (Number($(this).val()) < Number($(this).attr("min"))) {
                 invalid = true;
                 invalid = true;
                 $(this).addClass('inputMissingAttr');
                 $(this).addClass('inputMissingAttr');
               } else {
               } else {
@@ -175,12 +175,13 @@ $(document).ready(function() {
           }
           }
         }
         }
         if ($(this).attr("max")) {
         if ($(this).attr("max")) {
-          if ($(this).val() > $(this).attr("max")) {
+          if (Number($(this).val()) > Number($(this).attr("max"))) {
+            alert($(this).attr("max"))
             invalid = true;
             invalid = true;
             $(this).addClass('inputMissingAttr');
             $(this).addClass('inputMissingAttr');
           } else {
           } else {
             if ($(this).attr("min")) {
             if ($(this).attr("min")) {
-              if ($(this).val() < $(this).attr("min")) {
+              if (Number($(this).val()) < Number($(this).attr("min"))) {
                 invalid = true;
                 invalid = true;
                 $(this).addClass('inputMissingAttr');
                 $(this).addClass('inputMissingAttr');
               } else {
               } else {