[BUGFIX] IRRE children show no field values with useCombination 37/19337/3
authorStefan Froemken <froemken@gmail.com>
Wed, 27 Mar 2013 07:47:52 +0000 (08:47 +0100)
committerXavier Perseguers <xavier@typo3.org>
Tue, 10 Jun 2014 15:44:21 +0000 (17:44 +0200)
The IRRE option useCombination enables to use bi-directional
relations with IRRE items. This enables you to re-use IRRE
items multiple times (similar as FAL is working with IRRE).

To prevent the same child record from being used multiple
times, items already used are removed from the select box.
The code removing the item was written to remove an item
from a select box, but (accidentially) also targets a hidden
item which causes the JavaScript to break so that the field
values of the child objects are not filled on expanding.

By adding an additional check, this can be prevented.
For steps to reproduce refer to #46477.

Resolves: #46477
Releases: 6.2
Change-Id: Ie7fd89f6ef887b5d45c734dea8ec6ad9ac2a8d2c
Reviewed-on: https://review.typo3.org/19337
Reviewed-by: Fabien Udriot
Tested-by: Fabien Udriot
Reviewed-by: Zbigniew Jacko
Tested-by: Zbigniew Jacko
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.inline.js

index 3f768ed..7d1cda2 100644 (file)
@@ -388,10 +388,12 @@ var inline = {
                                var recordObj = document.getElementsByName(this.prependFormFieldNames+'['+unique.table+']['+recordUid+']['+unique.field+']');
                                var values = $H(unique.used).values();
                                if (recordObj.length) {
-                                       var selectedValue = recordObj[0].options[recordObj[0].selectedIndex].value;
-                                       for (var i=0; i<values.length; i++) {
-                                               if (values[i] != selectedValue) {
-                                                       this.removeSelectOption(recordObj[0], values[i]);
+                                       if (recordObj[0].hasOwnProperty('options')) {
+                                               var selectedValue = recordObj[0].options[recordObj[0].selectedIndex].value;
+                                               for (var i=0; i<values.length; i++) {
+                                                       if (values[i] != selectedValue) {
+                                                               this.removeSelectOption(recordObj[0], values[i]);
+                                                       }
                                                }
                                        }
                                }