From 1592197874a93d92600dbaa0a364b92d2618f620 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 31 Jan 2020 17:26:39 +0100 Subject: [PATCH] luci-base: validation.js: fix integer and float type validation Signed-off-by: Jo-Philipp Wich (cherry picked from commit 187bef9f6ce1263da21f72e91f79192847273ba7) --- modules/luci-base/htdocs/luci-static/resources/validation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/luci-base/htdocs/luci-static/resources/validation.js b/modules/luci-base/htdocs/luci-static/resources/validation.js index dbf30488c..0544e2f68 100644 --- a/modules/luci-base/htdocs/luci-static/resources/validation.js +++ b/modules/luci-base/htdocs/luci-static/resources/validation.js @@ -221,7 +221,7 @@ var ValidatorFactory = L.Class.extend({ types: { integer: function() { - return this.assert(this.factory.parseInteger(this.value) !== NaN, _('valid integer value')); + return this.assert(!isNaN(this.factory.parseInteger(this.value)), _('valid integer value')); }, uinteger: function() { @@ -229,7 +229,7 @@ var ValidatorFactory = L.Class.extend({ }, float: function() { - return this.assert(this.factory.parseDecimal(this.value) !== NaN, _('valid decimal value')); + return this.assert(!isNaN(this.factory.parseDecimal(this.value)), _('valid decimal value')); }, ufloat: function() { -- 2.25.1