Merge pull request #871 from quantum-dragons/pulls/fix-form-vallidation-exception-message

Fix exception error message fails when error in upload file.
This commit is contained in:
Robbie Averill 2019-03-26 14:44:57 +13:00 committed by GitHub
commit b1a04d6563
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -256,7 +256,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;
} }