InputValidator
The InputValidator makes it easy to perform common validation, such as email validation.
Usage#
When using the validator, you must manually call the result variable at the end of your validation.
new InputValidator("Input Value").exactly(5).resultThe result will always be one of the following:
True- Error occuredFalse- No Errorstring- Custom error text. Will be returned instead oftrue
Chaining Functions#
It is possible to chain validation functions to create complex validations
// Must be an email between 5 and 16 charactersnew InputValidator("Input Value").email().min(5).max(16).resultValidation Functions#
Email#
new InputValidator("Input Value").email("Optional Error Text").resultCPR#
new InputValidator("Input Value").cpr("Optional Error Text").resultMin#
// Minimum 5 charactersnew InputValidator("Input Value").min(5, "Optional Error Text").resultMax#
// Max 5 characternew InputValidator("Input Value").max(5, "Optional Error Text").resultExact#
// Exactly 5 charactersnew InputValidator("Input Value").email(5, "Optional Error Text").result