Bug in documentation – form custom validation
Notice: This thread is very old.
- Aurielle
- Member | 1281
The example from docs doesn't work for you because the code implies a function defined in the global namespace, not a method in the current class, even if the syntax is the same.
A bit of explanation of @Machy8's solution, the
$this->divisibilityValidator
syntax in
->addRule($this->divisibilityValidator, 'Number must be divisible by %d.', 8);
is a bit of a magic, the standard PHP way of specifying a callback would be
passing an array, like this: