[BUGFIX] Add buttons with `form` attribute to SplitButton save handling 27/45327/4
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Thu, 17 Dec 2015 10:34:39 +0000 (11:34 +0100)
committerMarkus Klein <markus.klein@typo3.org>
Thu, 17 Dec 2015 14:00:15 +0000 (15:00 +0100)
Some save buttons do not follow the `_save` naming convention, but have
a `form` attribute instead. IE does not support such attribute which
breaks the save buttons. Now all buttons with a `form` attribute are
added to the save button handling. To prevent side effects, the buttons
must be in the module header now.

Resolves: #72288
Related: #71598
Releases: master
Change-Id: I180725ebd03a7c480ec22058d6ed32a1cc5c5f2b
Reviewed-on: https://review.typo3.org/45327
Reviewed-by: Roman Schürmann <roman.schuermann@wmdb.de>
Tested-by: Roman Schürmann <roman.schuermann@wmdb.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/backend/Resources/Public/JavaScript/SplitButtons.js

index b9995ec..9279cf3 100644 (file)
@@ -32,12 +32,13 @@ define(['jquery', 'TYPO3/CMS/Backend/Icons'], function($, Icons) {
         */
        SplitButtons.initializeSaveHandling = function() {
                var elements = [
+                       'button[form]',
                        'button[name^="_save"]',
                        'a[data-name^="_save"]',
                        'button[name="CMD"][value^="save"]',
                        'a[data-name="CMD"][data-value^="save"]'
                ].join(',');
-               $(document).on('click', elements, function(e) {
+               $('.t3js-module-docheader').on('click', elements, function(e) {
                        var $me = $(this),
                                linkedForm = $me.attr('form') || $me.attr('data-form') || null,
                                $form = linkedForm ? $('#' + linkedForm) : $me.closest('form'),