#107336Primary button of SplitButton does not support href or data-* attributes
Description
Hello,
since the removal of setOnClick in the ButtonBar component (due to CSP, see #91814), we need alternative ways to link from backend modules to e.g. the TCE form module.
I tried the following options:
InputButton with data-attributes → does not render any data-* attributes on the primary button.
LinkButton with href → does not render the href for the primary button.
The relevant code is hardcoded here:
https://github.com/TYPO3/typo3/blob/2db50cbebdfbaf2cfd4c130e3ebcfad790ab8f72/typo3/sysext/backend/Classes/Template/Components/Buttons/SplitButton.php#L26
Currently, the primary button is restricted to form submission (
SplitButton is effectively limited to submitting a form on the same page.
It cannot be used for the common use case of opening TCE forms, popups, or other backend modules as the primary action.
Developers are forced into workarounds (manual markup, custom patches, multiple single buttons).
Suggested Solution:
Extend SplitButton so that the primary button also supports href and data-* attributes (independent of whether it is an InputButton or LinkButton).
This would align the primary button with the functionality already available for secondary buttons and make the component more useful in practice.
At the very least, if this restriction is intentional, it should be documented in the PHPDoc and/or manuals that SplitButton primary actions are only for form submissions.
Thanks
Stefan
Reviews 2
Files 2
History 510
-
Stefan Froemken changed subject
SplitButton primary button should support LinkButton (not only InputButton)Primary button of SplitButton does not support href or data-* attributes <span data-processor="relativetime" data-value="2025-08-27T09:24:19+00:00" > 08/27/25, 09:24 </span> -
Garvin Hicking commented and changed status
NewAccepted <span data-processor="relativetime" data-value="2025-08-27T20:19:24+00:00" > 08/27/25, 20:19 </span> -
Stefan Froemken commented <span data-processor="relativetime" data-value="2025-08-27T22:35:07+00:00" > 08/27/25, 22:35 </span>
The problem seems to be bigger than expected.
Deprecation: #103528 – Deprecated `DocumentSaveActions` module
The successor should be: @typo3/backend/form/submit-interceptor.js, but in my ModuleTemplate this JavaScript is not loaded.
This is an example from Core (EditDocumentController):
$saveButton = $buttonBar->makeInputButton() ->setForm('EditDocumentController') ->setIcon($this->iconFactory->getIcon('actions-document-save', IconSize::SMALL)) ->setName('_savedok') ->setShowLabelText(true) ->setTitle($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:rm.saveDoc')) ->setValue('1'); $buttonBar->addButton($saveButton, $position, $group);Currently, the form-name must be known by form-engine. Only there, the SubmitIntercepter will be loaded/initialized. As form-engine JS is not loaded within ModuleTemplate the setForm feature does not work out-of-the-box there.
In document-save-actions I found following:
"button[form]",'button[name^="_save"]','a[data-name^="_save"]','button[name="CMD"][value^="save"]','a[data-name="CMD"][data-value^="save"]'As the secondary options got a data-form attribute I also miss an “a[data-form]” selector. And SplitButton documentation expects “name” to be “save”, but it seems it must start with “_save”.
The primary InputButton with setForm() will work, because it is rendered as <input type="submit"> which, regardless of the given form, will submit any form where it is contained.
IMO SplitButton is totally broken for now.
Have a nice evening
Stefan
-
Gerrit Code Review pushed patch set 1 for main to change 90811 status
AcceptedUnder Review <span data-processor="relativetime" data-value="2025-09-26T11:03:36+00:00" > 09/26/25, 11:03 </span> -
Gerrit Code Review pushed patch set 2 for main to change 90811 <span data-processor="relativetime" data-value="2025-09-26T11:16:03+00:00" > 09/26/25, 11:16 </span>
-
Gerrit Code Review pushed patch set 3 for main to change 90811 <span data-processor="relativetime" data-value="2025-10-10T15:24:39+00:00" > 10/10/25, 15:24 </span>
-
Gerrit Code Review pushed patch set 4 for main to change 90811 <span data-processor="relativetime" data-value="2025-10-17T06:34:09+00:00" > 10/17/25, 06:34 </span>
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 91213 <span data-processor="relativetime" data-value="2025-10-23T06:27:30+00:00" > 10/23/25, 06:27 </span>
-
Garvin Hicking commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2025-10-23T06:40:10+00:00" > 10/23/25, 06:40 </span>Applied in changeset commit:553cb12b043a7f0476b909053fdd140e494cd300.
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2025-12-02T13:58:18+00:00" > 12/02/25, 13:58 </span>
Oli and me think this is an unneeded/unintentional restriction, and we should try to support this, yes!