summaryrefslogtreecommitdiffhomepage
path: root/libs/web/htdocs/luci-static/resources/cbi.js
diff options
context:
space:
mode:
Diffstat (limited to 'libs/web/htdocs/luci-static/resources/cbi.js')
-rw-r--r--libs/web/htdocs/luci-static/resources/cbi.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/libs/web/htdocs/luci-static/resources/cbi.js b/libs/web/htdocs/luci-static/resources/cbi.js
index 0a49a693a3..655ddbf53a 100644
--- a/libs/web/htdocs/luci-static/resources/cbi.js
+++ b/libs/web/htdocs/luci-static/resources/cbi.js
@@ -216,6 +216,33 @@ var cbi_validators = {
return false;
},
+ 'rangelength': function(min, max)
+ {
+ var val = '' + this;
+ if (!isNaN(min) && !isNaN(max))
+ return ((val.length >= min) && (val.length <= max));
+
+ return false;
+ },
+
+ 'minlength': function(min)
+ {
+ var val = '' + this;
+ if (!isNaN(min))
+ return (val.length >= min);
+
+ return false;
+ },
+
+ 'maxlength': function(max)
+ {
+ var val = '' + this;
+ if (!isNaN(max))
+ return (val.length <= max);
+
+ return false;
+ },
+
'or': function()
{
for (var i = 0; i < arguments.length; i += 2)