summaryrefslogtreecommitdiffhomepage
path: root/libs/web/htdocs
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2011-12-16 05:52:24 +0000
committerJo-Philipp Wich <jow@openwrt.org>2011-12-16 05:52:24 +0000
commit3a0905f21cb1afe307402cb8ea1d89096f28c141 (patch)
tree051bf3027671eba27184035f916466d9537cf022 /libs/web/htdocs
parentca7bc48ebc0b1f655088eaae89bd358556dc8824 (diff)
libs/web: add list(...) datatype for space separated lists of arbritary datatypes
Diffstat (limited to 'libs/web/htdocs')
-rw-r--r--libs/web/htdocs/luci-static/resources/cbi.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/libs/web/htdocs/luci-static/resources/cbi.js b/libs/web/htdocs/luci-static/resources/cbi.js
index d1e34d1786..8d32b669d1 100644
--- a/libs/web/htdocs/luci-static/resources/cbi.js
+++ b/libs/web/htdocs/luci-static/resources/cbi.js
@@ -234,6 +234,24 @@ var cbi_validators = {
return cbi_validators[args[0]](v.replace(/^\s*!\s*/, ''));
return false;
+ },
+
+ 'list': function(v, args)
+ {
+ var cb = cbi_validators[args[0] || 'string'];
+ if (typeof cb == "function")
+ {
+ var cbargs = args.slice(1);
+ var values = v.match(/[^\s]+/g);
+
+ for (var i = 0; i < values.length; i++)
+ if (!cb(values[i], cbargs))
+ return false;
+
+ return true;
+ }
+
+ return false;
}
};