Creating a custom validator

Add the following code to your theme file (or create a plugin for it) and customize it to suit. If the given value $value fails your own validation, then set $valid to false and set the error message by calling $element->addError(‘Your error message’);. See the examples below. Require that the value is equal to a … Continue reading Creating a custom validator