git.99rst.org
/
openwrt-luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
| inline |
side by side
(parent:
f32f42b
)
luci-base: validation.js: implement length() datatype validator
author
Jo-Philipp Wich
<redacted>
Wed, 11 Sep 2019 10:28:58 +0000
(12:28 +0200)
committer
Jo-Philipp Wich
<redacted>
Wed, 11 Sep 2019 10:28:58 +0000
(12:28 +0200)
Signed-off-by: Jo-Philipp Wich <redacted>
modules/luci-base/htdocs/luci-static/resources/validation.js
patch
|
blob
|
history
diff --git
a/modules/luci-base/htdocs/luci-static/resources/validation.js
b/modules/luci-base/htdocs/luci-static/resources/validation.js
index ca544cb15d0d71af5aa233560bf60d6821eefb76..79ae1d67070efa8a0e078099c4c36e19fad37b15 100644
(file)
--- 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),
git clone https://git.99rst.org/PROJECT