[BUGFIX] requestUpdate sensitive to spaces 74/22174/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:00:26 +0000 (22:00 +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/22174
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
Reviewed-by: Francois Suter
Tested-by: Francois Suter
typo3/sysext/backend/Classes/Form/FormEngine.php

index ad50bb9..ab49180 100644 (file)
@@ -1061,7 +1061,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'] && GeneralUtility::inList($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'], $field)) {
+                               if (
+                                       $GLOBALS['TCA'][$table]['ctrl']['type']
+                                       && !strcmp($field, $typeField)
+                                       || $GLOBALS['TCA'][$table]['ctrl']['requestUpdate']
+                                       && 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 {