From 794094caa20d922d968b4615f44a189f25f48a5e Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 4 Sep 2011 12:07:43 +0000 Subject: libs/web: add "neg()" cbi datatype to negate arbritary types, e.g. "neg(hostname)" would allow "!example.com" --- libs/web/htdocs/luci-static/resources/cbi.js | 8 ++++++++ 1 file changed, 8 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 1cd49bc65d..1e751d47e6 100644 --- a/libs/web/htdocs/luci-static/resources/cbi.js +++ b/libs/web/htdocs/luci-static/resources/cbi.js @@ -218,6 +218,14 @@ var cbi_validators = { if (!isNaN(max) && !isNaN(val)) return (val <= max); + return false; + }, + + 'neg': function(v, args) + { + if (args[0] && typeof cbi_validators[args[0]] == "function") + return cbi_validators[args[0]](v.replace(/^\s*!\s*/, '')); + return false; } }; -- cgit v1.2.3