diff options
-rw-r--r-- | libs/web/htdocs/luci-static/resources/cbi.js | 4 | ||||
-rw-r--r-- | libs/web/luasrc/cbi/datatypes.lua | 4 |
2 files changed, 8 insertions, 0 deletions
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 |