diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-12-05 00:19:09 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-12-05 00:19:09 +0000 |
commit | 090ce4f17e13e81a459e1ef0e9d6db974d97579c (patch) | |
tree | 403e87aff1873093f8c2816d64f466caa65a0c15 /libs/web/htdocs | |
parent | 8c9acb01f4e345a096042a994e1655b21689a3cf (diff) |
libs/web: add float and ufloat datatypes for field validation
Diffstat (limited to 'libs/web/htdocs')
-rw-r--r-- | libs/web/htdocs/luci-static/resources/cbi.js | 10 |
1 files changed, 10 insertions, 0 deletions
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); |