From 9dda4c651c93a32753af1b833f94bd7aefc5f97a Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 5 Nov 2018 11:13:39 +0100 Subject: [PATCH] luci-base: cbi.js: add client-side hexstring datatype validator Signed-off-by: Jo-Philipp Wich --- modules/luci-base/htdocs/luci-static/resources/cbi.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js index d9b9baf7be..1c2b14df69 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')); } } }; -- 2.30.2