Add a new validation method. It must consist of a name (must be a legal javascript identifier), a javascript based function and a default string message.
Please note: While the temptation is great to add a regex method that checks it's parameter against the value, it is much cleaner to encapsulate those regular expressions inside their own method. If you need lots of slightly different expressions, try to extract a common parameter.
A library of regular expressions: http://regexlib.com/DisplayPatterns.aspx
Arguments:
| name | String | |
|---|---|---|
| The name of the method, used to identify and referencing it, must be a valid javascript identifier | ||
| method | Callback | |
| The actual method implementation, returning true if an element is valid | ||
| message | String, Function | |
| The default message to display for this method. Can be a function created by String.format(value). | ||