[BUGFIX] requestUpdate sensitive to spaces 86/22186/2
authorFrancois Suter <francois@typo3.org>
Wed, 10 Jul 2013 12:12:32 +0000 (14:12 +0200)
committerFrancois Suter <francois@typo3.org>
Wed, 10 Jul 2013 20:29:54 +0000 (22:29 +0200)
The TCA property "requestUpdate" is sensitive to spaces, although this
is documented nowhere. Indeed "foo1, foo2" will not work whereas
"foo1,foo2" does. This patch strips spaces from the "requestUpdate"
string before testing it.

Resolves: #42789
Releases: 6.2, 6.1, 6.0, 4.7, 4.5
Change-Id: I340090e93e7b8645493f8db0c8c374cb1227f684
Reviewed-on: https://review.typo3.org/22186
Reviewed-by: Francois Suter
Tested-by: Francois Suter
typo3/sysext/backend/Classes/Form/FormEngine.php

index 9c691cc..f298218 100644 (file)
@@ -1043,7 +1043,12 @@ class FormEngine {
                                        $typeField = substr($GLOBALS['TCA'][$table]['ctrl']['type'], 0, strpos($GLOBALS['TCA'][$table]['ctrl']['type'], ':'));
                                }
                                // Create a JavaScript code line which will ask the user to save/update the form due to changing the element. This is used for eg. "type" fields and others configured with "requestUpdate"
-                               if ($GLOBALS['TCA'][$table]['ctrl']['type'] && !strcmp($field, $typeField) || $GLOBALS['TCA'][$table]['ctrl']['requestUpdate'] && \TYPO3\CMS\Core\Utility\GeneralUtility::inList($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'], $field)) {
+                               if (
+                                       $GLOBALS['TCA'][$table]['ctrl']['type']
+                                       && !strcmp($field, $typeField)
+                                       || $GLOBALS['TCA'][$table]['ctrl']['requestUpdate']
+                                       && \TYPO3\CMS\Core\Utility\GeneralUtility::inList(str_replace(' ', '', $GLOBALS['TCA'][$table]['ctrl']['requestUpdate']), $field)
+                               ) {
                                        if ($GLOBALS['BE_USER']->jsConfirmation(1)) {
                                                $alertMsgOnChange = 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
                                        } else {