Fix error message to return the proper error with validate

This commit is contained in:
Christopher Joe 2015-10-05 16:28:38 +13:00
parent 09ec50bf2d
commit d1a6271235

View File

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