libs/web: add "neg()" cbi datatype to negate arbritary types, e.g. "neg(hostname...
[project/luci.git] / libs / web / htdocs / luci-static / resources / cbi.js
index 1cd49bc..1e751d4 100644 (file)
@@ -219,6 +219,14 @@ var cbi_validators = {
                        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;
        }
 };