[BUGFIX] Recover switched items in maxitems=1 selectMultipleSideBySide 29/58729/2
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 10:12:45 +0000 (12:12 +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/58729
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js

index f60fafa..698053b 100644 (file)
@@ -122,6 +122,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();
       }