It's not possible with the input mask plugin we use at the moment, which is getting a but long in the tooth. I've been looking at this one:
https://github.com/RobinHerbots/Inputmask
... which is all singing, all dancing, with lots of bells and whistles, and would do what you need (a variable length mask). It's a bit heavyweight, but we can live with that for the extra functionality. The main problem is that it would break backward compat with existing mask definitions. There's nothing the old one can do that this one can't, it just does things differently.
So for now, you best bet is to enforce it with a JS event which check it and barfs if it doesn't match a regular expression. So a 'blur' event on that field, which does something like ..
Code:
if (!this.getValue().test(/^[^/]+\/[^/]+-[^/]+\/[^/]+$/)) {
alert("How many times do I have to tell you to use Name/Position-Dept/Organisation format?");
}
In that regex ...
/.../ the whole pattern is surrounded by slashes, not part of the pattern, just tells Javascript this is a regex
^ means "start of string"
[^/]+ means "one or more of anything except a /
\/ means "a /"
- means -
$ means "end of string"
So it's ...
start
one or more of anything except a /
followed by a /
followed by one or more of anything except a /
followed by a -
followed by one or more of anything except a /
followed by a /
followed by one or more of anything except a /
end
You could get more specific, and force alphanumeric plus acceptable other chars, but that pattern will get you the basic shape.
-- hugh