summaryrefslogtreecommitdiffhomepage
path: root/libs/web
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2012-02-14 15:16:53 +0000
committerJo-Philipp Wich <jow@openwrt.org>2012-02-14 15:16:53 +0000
commit63a75c6ea924120273f27a297fae4978ab81d83f (patch)
tree0d9d7975818a5039c37578867c317eaf7649d8d0 /libs/web
parentcd4e008cc1536f77d3b879ff9e56b74ce70c828a (diff)
libs/web: implement new phone digit datatype, useful for VoIP related config screens
Diffstat (limited to 'libs/web')
-rw-r--r--libs/web/htdocs/luci-static/resources/cbi.js4
-rw-r--r--libs/web/luasrc/cbi/datatypes.lua4
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 7171574ef1..8ced4419ae 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 71f4a2a561..87019c2250 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