Skip to content

Custom validator messages not showing #273

@Ruslan-Aleev

Description

@Ruslan-Aleev

Bug report

Summary

The documentation (https://docs.modx.com/current/en/extras/formit/formit.validators#custom-validators) has an example of a custom validator:

<?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).

Environment

FormIt 4.2.7-pl
MODX 2.8.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions