From: Jo-Philipp Wich Date: Mon, 5 Nov 2018 10:13:39 +0000 (+0100) Subject: luci-base: cbi.js: add client-side hexstring datatype validator X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9dda4c651c93a32753af1b833f94bd7aefc5f97a;p=oweals%2Fluci.git luci-base: cbi.js: add client-side hexstring datatype validator Signed-off-by: Jo-Philipp Wich --- diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js index d9b9baf7b..1c2b14df6 100644 --- a/modules/luci-base/htdocs/luci-static/resources/cbi.js +++ b/modules/luci-base/htdocs/luci-static/resources/cbi.js @@ -582,6 +582,11 @@ var CBIValidatorPrototype = { return this.apply(subvalidator, undefined, subargs); return this.assert(true); + }, + + hexstring: function() { + return this.assert(this.value.match(/^([a-f0-9][a-f0-9]|[A-F0-9][A-F0-9])+$/), + _('hexadecimal encoded value')); } } };