From 090ce4f17e13e81a459e1ef0e9d6db974d97579c Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 5 Dec 2010 00:19:09 +0000 Subject: libs/web: add float and ufloat datatypes for field validation --- libs/web/htdocs/luci-static/resources/cbi.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libs/web/htdocs') diff --git a/libs/web/htdocs/luci-static/resources/cbi.js b/libs/web/htdocs/luci-static/resources/cbi.js index 3959b6937..992b5588e 100644 --- a/libs/web/htdocs/luci-static/resources/cbi.js +++ b/libs/web/htdocs/luci-static/resources/cbi.js @@ -27,6 +27,16 @@ var cbi_validators = { return (cbi_validators.integer(v) && (v >= 0)); }, + 'float': function(v) + { + return !isNaN(parseFloat(v)); + }, + + 'ufloat': function(v) + { + return (cbi_validators['float'](v) && (v >= 0)); + }, + 'ipaddr': function(v) { return cbi_validators.ip4addr(v) || cbi_validators.ip6addr(v); -- cgit v1.2.3