MINOR: Allow a validation error to be thrown when a DataObject is saved in ComplexTableField.

From: Andrew Short <andrewjshort@gmail.com> (from r95034)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@97431 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew Short 2010-01-22 01:36:52 +00:00 committed by Sam Minnee
parent c826191897
commit 9e55bc17a7

View File

@ -809,9 +809,9 @@ class ComplexTableField_ItemRequest extends RequestHandler {
*/ */
function saveComplexTableField($data, $form, $request) { function saveComplexTableField($data, $form, $request) {
$dataObject = $this->dataObj(); $dataObject = $this->dataObj();
$form->saveInto($dataObject);
try { try {
$form->saveInto($dataObject);
$dataObject->write(); $dataObject->write();
} catch(ValidationException $e) { } catch(ValidationException $e) {
$form->sessionMessage($e->getResult()->message(), 'bad'); $form->sessionMessage($e->getResult()->message(), 'bad');