diff --git a/docs/en/02_Developer_Guides/03_Forms/01_Validation.md b/docs/en/02_Developer_Guides/03_Forms/01_Validation.md index 4b4776c57..a3a049f3d 100644 --- a/docs/en/02_Developer_Guides/03_Forms/01_Validation.md +++ b/docs/en/02_Developer_Guides/03_Forms/01_Validation.md @@ -166,8 +166,10 @@ class Page_Controller extends ContentController $check = Member::get()->filter('Email', $data['Email'])->first(); if ($check) { - $form->addErrorMessage('Email', 'This email already exists', 'bad'); - + $validationResult = new ValidationResult(); + $validationResult->addFieldError('Email', 'This email already exists'); + $form->setSessionValidationResult($validationResult); + $form->setSessionData($form->getData()); return $this->redirectBack(); }