<?php
$value = (float)$value;
$success = $value > 1000;
if (!$success) {
// Note how we can add an error to the field here.
$validator->addError($key,'Not big enough!');
}
return $success;
But when trying to display an error message about the custom validator, nothing is displayed.
[[!+fi.error.fieldName]] (fieldName is the field for validation) returns nothing.
At the same time, the messages of standard validators are displayed normally.
Moreover, this is also true for external validators, for example, ReCaptchaV2 (there is a built-in validator that also does not return a lexicon with an error).
Bug report
Summary
The documentation (https://docs.modx.com/current/en/extras/formit/formit.validators#custom-validators) has an example of a custom validator:
But when trying to display an error message about the custom validator, nothing is displayed.
[[!+fi.error.fieldName]]
(fieldName is the field for validation) returns nothing. At the same time, the messages of standard validators are displayed normally.Moreover, this is also true for external validators, for example, ReCaptchaV2 (there is a built-in validator that also does not return a lexicon with an error).
Environment
FormIt 4.2.7-pl MODX 2.8.4