mirror of
https://github.com/silverstripe/silverstripe-spamprotection.git
synced 2024-10-22 14:05:59 +02:00
Fix error message to return the proper error with validate
This commit is contained in:
parent
09ec50bf2d
commit
d1a6271235
@ -106,8 +106,12 @@ if(class_exists('EditableFormField')) {
|
||||
|
||||
public function validateField($data, $form) {
|
||||
$formField = $this->getFormField();
|
||||
if (!$formField->validate($form->getValidator())) {
|
||||
$form->addErrorMessage($this->Name, $this->getErrorMessage()->HTML(), 'error', false);
|
||||
$validator = $form->getValidator();
|
||||
if (!$formField->validate($validator)) {
|
||||
foreach($validator->getErrors() as $error) {
|
||||
$this->owner->CustomErrorMessage = $error['message'];
|
||||
$form->addErrorMessage($this->Name, $this->getErrorMessage()->HTML(), 'error', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user