Merge pull request #9415 from botzkobg/4

Form validation should throw ValidationException
This commit is contained in:
Loz Calver 2020-04-08 09:33:20 +01:00 committed by GitHub
commit f1c74c3570
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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();
}