File tree Expand file tree Collapse file tree
user_guide_src/source/libraries Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -383,6 +383,26 @@ This method sets a rule group from the validation configuration to the validatio
383383
384384 $validation->setRuleGroup('signup');
385385
386+ Running Multiple Validations
387+ =======================================================
388+
389+ .. note :: ``run()`` method will not reset error state. Should a previous run fail,
390+ ``run() `` will always return false and ``getErrors() `` will return
391+ all previous errors until explicitly reset.
392+
393+ If you intend to run multiple validations, for instance on different data sets or with different
394+ rules after one another, you might need to call ``$validation->reset() `` before each run to get rid of
395+ errors from previous run. Be aware that ``reset() `` will invalidate any data, rule or custom error
396+ you previously set, so ``setRules() ``, ``setRuleGroup() `` etc. need to be repeated::
397+
398+ for ($userAccounts as $user) {
399+ $validation->reset();
400+ $validation->setRules($userAccountRules);
401+ if (!$validation->run($user)) {
402+ // handle validation errors
403+ }
404+ }
405+
386406Working With Errors
387407************************************************
388408
You can’t perform that action at this time.
0 commit comments