mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
ENHANCEMENT Support for DataObject->validate() and ValidationException catching in ModelAdmin->doSave()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@77855 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
a1b04f1018
commit
40a2c3bb7c
@ -921,7 +921,13 @@ class ModelAdmin_RecordController extends Controller {
|
||||
*/
|
||||
function doSave($data, $form, $request) {
|
||||
$form->saveInto($this->currentRecord);
|
||||
$this->currentRecord->write();
|
||||
|
||||
try {
|
||||
$this->currentRecord->write();
|
||||
} catch(ValidationException $e) {
|
||||
$form->sessionMessage($e->getResult()->message(), 'bad');
|
||||
}
|
||||
|
||||
|
||||
// Behaviour switched on ajax.
|
||||
if(Director::is_ajax()) {
|
||||
|
Loading…
Reference in New Issue
Block a user