Fix exception error message fails when error in upload file.

This commit is contained in:
Ishan Jayamanne 2019-03-26 01:28:36 +00:00
parent 5c8f086f3e
commit 3615f416e3

View File

@ -252,7 +252,9 @@ JS
$upload->loadIntoFile($_FILES[$field->Name], $file, $foldername); $upload->loadIntoFile($_FILES[$field->Name], $file, $foldername);
} catch (ValidationException $e) { } catch (ValidationException $e) {
$validationResult = $e->getResult(); $validationResult = $e->getResult();
$form->addErrorMessage($field->Name, $validationResult->message(), 'bad'); foreach ($validationResult->getMessages() as $message) {
$form->sessionMessage($message['message'], ValidationResult::TYPE_ERROR);
}
Controller::curr()->redirectBack(); Controller::curr()->redirectBack();
return; return;
} }