mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Form validation should throw ValidationException instead of calling unexisting method "addErrorMessage()"
This commit is contained in:
parent
41da6d74fb
commit
a1f0f2f45d
@ -163,9 +163,9 @@ class Page_Controller extends ContentController
|
|||||||
$check = Member::get()->filter('Email', $data['Email'])->first();
|
$check = Member::get()->filter('Email', $data['Email'])->first();
|
||||||
|
|
||||||
if ($check) {
|
if ($check) {
|
||||||
$form->addErrorMessage('Email', 'This email already exists', 'bad');
|
$validationResult = new ValidationResult();
|
||||||
|
$validationResult->addFieldError('Email', 'This email already exists');
|
||||||
return $this->redirectBack();
|
throw new ValidationException($validationResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user