libs/web: implement new phone digit datatype, useful for VoIP related config screens
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 14 Feb 2012 15:16:53 +0000 (15:16 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 14 Feb 2012 15:16:53 +0000 (15:16 +0000)
libs/web/htdocs/luci-static/resources/cbi.js
libs/web/luasrc/cbi/datatypes.lua

index 7171574ef13f4fa29d8ac6f176cd99e7eb37c241..8ced4419aec9c4d45652c24aa6b38e9573636241 100644 (file)
@@ -269,6 +269,10 @@ var cbi_validators = {
                                return false;
 
                return true;
+       },
+       'phonedigit': function()
+       {
+               return (this.match(/^[0-9\*#]+$/) != null);
        }
 };
 
index 71f4a2a5614e429bf4eaa2fe336851baee53d7f6..87019c22508593098d19c7da6df8fc8c2eec866a 100644 (file)
@@ -305,3 +305,7 @@ function max(val, max)
 
        return false
 end
+
+function ponedigit(val)
+       return (val:match("^[0-9\*#]+$") ~= nil)
+end