Issue Bug Closed

#87721Attempt to insert record on page '[root-level]' (0) where this table, <table-name>, is not allowed, error while creating a new record

Anu Bhuvanendran Nair 02/15/19, 11:30 updated 05/07/19, 12:10

Description

While creating a new record into a folder from the list module. There is a ‘new’ button along save and close, which is unnecessary at the moment unless the record is saved.
If this new button is clicked and tried to generate a new record before saving, an error ‘Attempt to insert record on page ‘[root-level]’ (0) where this table, <table-name>, is not allowed’ will be triggered.</table-name>

A solution workaround is, in \TYPO3\CMS\Backend\Controller\EditDocumentController a condition can be used and checked to prevent ‘new’ button in the ‘new’ cmd context.

    /**
     * Create the panel of buttons for submitting the form or otherwise perform operations.
     *
     * @param ServerRequestInterface $request
     */
    protected function getButtons(ServerRequestInterface $request): void
    {
        .....

        if($this->firstEl['cmd']!='new') {
            $this->registerNewButtonToButtonBar(
                $buttonBar,
                ButtonBar::BUTTON_POSITION_LEFT,
                4,
                $sysLanguageUid,
                $l18nParent
            );
        }

        .....
    }

Reviews 2