[BUGFIX] Do not add empty alert fieldChangeFunc to link browser URL 23/50623/2
authorMarkus Klein <markus.klein@typo3.org>
Thu, 10 Nov 2016 22:02:42 +0000 (23:02 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Sun, 13 Nov 2016 12:53:11 +0000 (13:53 +0100)
Adding an empty alert message to the fieldChangeFunc array causes
the fieldChangeFunc_hash to mismatch when pagination or search
is used in the link browser popup.

Add a check for an empty value, which is already present in another
place in Core.

Resolves: #75743
Releases: master, 7.6
Change-Id: I1a15400960d577c1a2a0a905643b56533d957100
Reviewed-on: https://review.typo3.org/50623
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/backend/Classes/Form/Container/SingleFieldContainer.php

index 16b1fee..85fddaf 100644 (file)
@@ -154,7 +154,9 @@ class SingleFieldContainer extends AbstractContainer
         // JavaScript code for event handlers:
         $parameterArray['fieldChangeFunc'] = [];
         $parameterArray['fieldChangeFunc']['TBE_EDITOR_fieldChanged'] = 'TBE_EDITOR.fieldChanged(' . GeneralUtility::quoteJSvalue($table) . ',' . GeneralUtility::quoteJSvalue($row['uid']) . ',' . GeneralUtility::quoteJSvalue($fieldName) . ',' . GeneralUtility::quoteJSvalue($parameterArray['itemFormElName']) . ');';
-        $parameterArray['fieldChangeFunc']['alert'] = $alertMsgOnChange;
+        if ($alertMsgOnChange) {
+            $parameterArray['fieldChangeFunc']['alert'] = $alertMsgOnChange;
+        }
 
         // If this is the child of an inline type and it is the field creating the label
         if ($this->isInlineChildAndLabelField($table, $fieldName)) {