Skip to content

Commit

Permalink
Merge pull request #11 from adrexia/feature/silverstripe-4
Browse files Browse the repository at this point in the history
FIX: handle error response in ss4
  • Loading branch information
stevie-mayhew authored Aug 23, 2017
2 parents 9cd209b + 212f2e1 commit 1999d04
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion code/SingleObjectAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ public function doSave($data, $form)
$form->saveInto($object);
$object->write();
} catch (ValidationException $e) {
$form->sessionMessage($e->getResult()->message(), 'bad');
$result = $e->getResult();
$form->loadMessagesFrom($result);

$responseNegotiator = new PjaxResponseNegotiator(array(
'CurrentForm' => function () use (&$form) {
return $form->forTemplate();
Expand Down

0 comments on commit 1999d04

Please sign in to comment.