summaryrefslogtreecommitdiffhomepage
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-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 b4137d4865..8e2f62aea2 100644
--- a/libs/web/htdocs/luci-static/resources/cbi.js
+++ b/libs/web/htdocs/luci-static/resources/cbi.js
@@ -152,6 +152,10 @@ var cbi_validators = {
return (v.length == 5) || (v.length == 13);
},
+ 'uciname': function(v)
+ {
+ return (v.match(/^[a-zA-Z0-9_]+$/) != null);
+ }
};
diff --git a/libs/web/luasrc/cbi/datatypes.lua b/libs/web/luasrc/cbi/datatypes.lua
index 53a34547ba..a9aba95493 100644
--- a/libs/web/luasrc/cbi/datatypes.lua
+++ b/libs/web/luasrc/cbi/datatypes.lua
@@ -204,3 +204,7 @@ function device( val, seen )
return false
end
+
+function uciname(val)
+ return (val:match("^[a-zA-Z0-9_]+$") != nil)
+end