Cutelyst
2.13.0
|
Stores custom error messages and the input field label. More...
#include <Cutelyst/Plugins/Utils/ValidatorRule>
Public Member Functions | |
ValidatorMessages () | |
Constructs a default ValidatorMessages object with all custom messages disabled. | |
ValidatorMessages (const char *customLabel, const char *customValidationError=nullptr, const char *customParsingError=nullptr, const char *customValidationDataError=nullptr) | |
Constructs a new ValidatorMessages object with the given parameters. More... | |
Public Attributes | |
const char * | label |
const char * | parsingError |
const char * | validationDataError |
const char * | validationError |
This struct is used by ValidatorRule derived classes to store custom error messages that are also translatable. To make the messages translatable, use QT_TRANSLATE_NOOP() so that the message can be dynamically translated by the current Context . If you want to omit a custom message, simply use a nullptr
for it. For custom messages that are not set, the ValidatorRule class will return a generic message that will also be translated if Cutelyst has a translation file for the current language in the context.
The translation context used in the QT_TRANSLATE_NOOP() definition has to be the same that has been set on the Validator contstructor. If you dont want to use translation for the messages and the label, simply don't use QT_TRANSLATE_NOOP() when adding the string but simply use a C string literal and also leave the translation context on the Validator constructor empty.
Definition at line 144 of file validatorrule.h.
|
inline |
customLabel | User visible label for the input field. Should be the same as used on the frontend visible to the user. Will be used by generic error messages if set. |
customValidationError | Custom error message if the validation fails. |
customParsingError | Custom error message if the input value could not be parsed. |
customValidationDataError | Custom error message if validation data is missing or invalid. |
Definition at line 157 of file validatorrule.h.
const char* Cutelyst::ValidatorMessages::label |
Field label used for generating generic error messages.
Definition at line 163 of file validatorrule.h.
const char* Cutelyst::ValidatorMessages::parsingError |
Custom parsing error message.
Definition at line 165 of file validatorrule.h.
const char* Cutelyst::ValidatorMessages::validationDataError |
Custom validation data error message.
Definition at line 166 of file validatorrule.h.
const char* Cutelyst::ValidatorMessages::validationError |
Custom validation error messages.
Definition at line 164 of file validatorrule.h.