mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #9415 from botzkobg/4
Form validation should throw ValidationException
This commit is contained in:
commit
f1c74c3570
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user