6 #include "validatorrequiredwith_p.h" 13 :
ValidatorRule(*new ValidatorRequiredWithPrivate(field, otherFields, messages))
25 if (d->otherFields.empty()) {
27 qCWarning(C_VALIDATOR).noquote() <<
debugString(c) <<
"Invalid validation data";
29 bool containsOther =
false;
35 for (
const QString &other : ofc) {
48 qCDebug(C_VALIDATOR).noquote()
49 <<
debugString(c) <<
"The field is not present or empty but the field \"" 50 << otherField <<
"\" is present";
68 return c->
qtTrId(
"cutelyst-validator-genvalerr-req");
70 return c->
qtTrId(
"cutelyst-validator-genvalerr-req-label").
arg(_label);
Stores custom error messages and the input field label.
bool isEmpty() const const
The Cutelyst namespace holds all public Cutelyst API.
Base class for all validator rules.
QString label(Context *c) const
QString value(const ParamsMultiMap ¶ms) const
ValidatorReturnType validate(Context *c, const ParamsMultiMap ¶ms) const override
~ValidatorRequiredWith() override
bool contains(const Key &key) const const
QString validationError(Context *c, const QVariant &errorData={}) const
QString validationDataError(Context *c, const QVariant &errorData={}) const
QString qtTrId(const char *id, int n=-1) const
ValidatorRequiredWith(const QString &field, const QStringList &otherFields, const ValidatorMessages &messages=ValidatorMessages())
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
The field under validation must be present and not empty only if any of the other specified fields is...
QString genericValidationError(Context *c, const QVariant &errorData=QVariant()) const override
Contains the result of a single input parameter validation.
QString debugString(Context *c) const