From: Jo-Philipp Wich Date: Tue, 14 Feb 2012 15:16:53 +0000 (+0000) Subject: libs/web: implement new phone digit datatype, useful for VoIP related config screens X-Git-Tag: 0.11.0~1115 X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=63a75c6ea924120273f27a297fae4978ab81d83f libs/web: implement new phone digit datatype, useful for VoIP related config screens --- diff --git a/libs/web/htdocs/luci-static/resources/cbi.js b/libs/web/htdocs/luci-static/resources/cbi.js index 7171574ef..8ced4419a 100644 --- a/libs/web/htdocs/luci-static/resources/cbi.js +++ b/libs/web/htdocs/luci-static/resources/cbi.js @@ -269,6 +269,10 @@ var cbi_validators = { return false; return true; + }, + 'phonedigit': function() + { + return (this.match(/^[0-9\*#]+$/) != null); } }; diff --git a/libs/web/luasrc/cbi/datatypes.lua b/libs/web/luasrc/cbi/datatypes.lua index 71f4a2a56..87019c225 100644 --- a/libs/web/luasrc/cbi/datatypes.lua +++ b/libs/web/luasrc/cbi/datatypes.lua @@ -305,3 +305,7 @@ function max(val, max) return false end + +function ponedigit(val) + return (val:match("^[0-9\*#]+$") ~= nil) +end