import dojo.widgets.DojoLib;
use DojoLib;
You set each key in the dictionary to a Boolean value, such that true means required, false means disallowed, and [true, false] means optional.
myDictionary Dictionary {allowCruft = true};
Validators.EmailValidator("mailto:you@example.com", myDictionary);
myDictionary Dictionary {allowDottedDecimal = true, allowIPV6 = false};
Validators.IPValidator("191.0.2.1", myDictionary);
# Represents a digit, 0-9.
? Represents a digit, 0-9; but the digit is optional.
Other characters are as is.
Here are examples:
"(###) ###-####" -> (999) 999-9999
"(###) ###-#### x#???" -> (999) 9999-9999 x123
Here is an example invocation:
myDictionary Dictionary {format = "(###) ###-####"};
Validators.NumberFormatValidator("191.42", myDictionary);
Validators.PatternValidator("1234", "[0-9]+");
For background information, consider Mastering Regular Expressions by Jeffrey E.F. Friedl; O'Reilly Media, August 2006, ISBN 978-0-596-52812-6.
Here is an example invocation:
myDictionary Dictionary {min = 10, max = 20};
Validators.RangeValidator("18", myDictionary);
myDictionary Dictionary {length = 4};
Validators.TextValidator("Four", myDictionary);
myDictionary Dictionary {};
Validators.TextValidator("", myDictionary);
You typically access those functions from a validator function; specifically, from a function that is referenced in the validators property of the DojoTextField widget.