Form validation should throw ValidationException instead of calling unexisting method "addErrorMessage()"

This commit is contained in:
botzko 2020-02-21 23:55:38 +00:00
parent 41da6d74fb
commit a1f0f2f45d

View File

@ -163,9 +163,9 @@ class Page_Controller extends ContentController
$check = Member::get()->filter('Email', $data['Email'])->first();
if ($check) {
$form->addErrorMessage('Email', 'This email already exists', 'bad');
return $this->redirectBack();
$validationResult = new ValidationResult();
$validationResult->addFieldError('Email', 'This email already exists');
throw new ValidationException($validationResult);
}