libs/web: introduce "uciname" datatype for cbi validation

This commit is contained in:
Jo-Philipp Wich 2010-10-30 18:12:39 +00:00
parent fc5b9e27f0
commit 4622241535
2 changed files with 8 additions and 0 deletions

View file

@ -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);
}
};

View file

@ -204,3 +204,7 @@ function device( val, seen )
return false
end
function uciname(val)
return (val:match("^[a-zA-Z0-9_]+$") != nil)
end