[BUGFIX] Recover switched items in maxitems=1 selectMultipleSideBySide 99/58599/4
authorKevin von Spiczak <caevv@me.com>
Tue, 9 Oct 2018 11:32:37 +0000 (13:32 +0200)
committerBenni Mack <benni@typo3.org>
Sat, 27 Oct 2018 09:52:31 +0000 (11:52 +0200)
Shows and re-enables all the options, that are currently not selected
when using maxitems = 1

Resolves: #86594
Releases: master, 8.7
Change-Id: I1f5e727ec42203981edaaf4b79bb6e201352d296
Reviewed-on: https://review.typo3.org/58599
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Nicolai Schirawski <ns@t3magic.de>
Tested-by: Nicolai Schirawski <ns@t3magic.de>
Reviewed-by: Eike Starkmann <starkmann@undkonsorten.com>
Tested-by: Eike Starkmann <starkmann@undkonsorten.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js

index 1ea5529..f6ff5f2 100644 (file)
@@ -133,6 +133,13 @@ define(['jquery',
     if (isMultiple || isList) {
       // If multiple values are not allowed, clear anything that is in the control already
       if (!isMultiple) {
+        var $availableFieldEl = FormEngine.getFieldElement(fieldName, '_avail');
+        $fieldEl.find('option').each(function() {
+          $availableFieldEl
+            .find('option[value="' + $.escapeSelector($(this).attr('value')) + '"]')
+            .removeClass('hidden')
+            .prop('disabled', false);
+        });
         $fieldEl.empty();
       }