Created
May 29, 2020 07:20
-
-
Save Anubarak/090a333d8c01b1567f48b99c1be1259d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$model = new DynamicModel($request->getBodyParams(), [ | |
[ | |
['firstname', 'lastname', 'mail', 'privacy'], | |
'required', | |
'message' => Craft::t('site', "Folgendes Feld Fehlt: {attribute}") | |
] | |
]); | |
$model->addRule('minEntryTimeMethod', static function() use ($model){ | |
if (/* kleiner als 3s */) { | |
$model->addError('title', "Sie haben zu schnell abgesendet"); | |
} | |
}); | |
$model->validate(); | |
$model->getErrors(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment