summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs/luci-static/resources/validation.js
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources/validation.js')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/validation.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/validation.js b/modules/luci-base/htdocs/luci-static/resources/validation.js
index ca544cb15..79ae1d670 100644
--- a/modules/luci-base/htdocs/luci-static/resources/validation.js
+++ b/modules/luci-base/htdocs/luci-static/resources/validation.js
@@ -419,6 +419,12 @@ var ValidatorFactory = L.Class.extend({
return this.assert(this.factory.parseDecimal(this.value) <= +max, _('value smaller or equal to %f').format(max));
},
+ length: function(len) {
+ var val = '' + this.value;
+ return this.assert(val.length == +len,
+ _('value with %d characters').format(len));
+ },
+
rangelength: function(min, max) {
var val = '' + this.value;
return this.assert((val.length >= +min) && (val.length <= +max),