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