silverstripe-gridfield-betterbuttons icon indicating copy to clipboard operation
silverstripe-gridfield-betterbuttons copied to clipboard

onBeforeWrite() is not called by "Save and close"

Open minimalic opened this issue 9 years ago • 1 comments

The function onBeforeWrite() works on DataObject with "Save" but not with "Save and close". Is this problem already known?

minimalic avatar Jul 04 '16 01:07 minimalic

Any updates on this? I have a Dataobject which is saving correctly with the "Save" button, but does not save correctly with "Save and close". The feature is a checkbox on manyManyExtra Fields, and the DO attempts to validate() that object by checking the value.

This is within a custom GridFieldDetailForm, so I worked around it by disabling BetterButtons specifically for that form:

    public function getCMSFields(){
            ...
            $myDataObject = singleton('MyDataObject');

            //BetterButtons "Save and Close" doesn't work on this custom GridFieldDetailForm, so disable it
            //see @link https://github.com/unclecheese/silverstripe-gridfield-betterbuttons/issues/139
            $myDataObject->config()->better_buttons_enabled = false;
            ...

silverstripe-elliot avatar Feb 21 '17 21:02 silverstripe-elliot