[BUGFIX] Flexform Form ID should not contain brackets 71/52771/7
authorBenjamin Serfhos <serfhos@gmail.com>
Thu, 11 May 2017 12:30:15 +0000 (14:30 +0200)
committerTymoteusz Motylewski <t.motylewski@gmail.com>
Mon, 30 Oct 2017 08:49:58 +0000 (09:49 +0100)
Using brackets in flexform elements caused the javascript to be disabled
for the element.
While using a custom form id that can be used as HTML id="" this is
bypassed and fixes all javascript interaction.

Releases: master, 8.7
Resolves: #80908
Change-Id: I91f39b2fed61076b7139603fedc7b268546d64cd
Reviewed-on: https://review.typo3.org/52771
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
typo3/sysext/backend/Classes/Form/Container/FlexFormElementContainer.php

index f085e8f..c73729a 100644 (file)
@@ -111,8 +111,7 @@ class FlexFormElementContainer extends AbstractContainer
                         $fakeParameterArray['fieldChangeFunc']['TBE_EDITOR_fieldChanged'] = str_replace($originalFieldName, $fakeParameterArray['itemFormElName'], $fakeParameterArray['fieldChangeFunc']['TBE_EDITOR_fieldChanged']);
                     }
                 }
-                // @todo: is that a bug? name and id should usually be of different form
-                $fakeParameterArray['itemFormElID'] = $fakeParameterArray['itemFormElName'];
+                $fakeParameterArray['itemFormElID'] = $parameterArray['itemFormElID'] . '_' . preg_replace('/[^a-zA-Z0-9_-]/', '_', $flexFormFieldName);
                 if (isset($flexFormRowData[$flexFormFieldName]['vDEF'])) {
                     $fakeParameterArray['itemFormElValue'] = $flexFormRowData[$flexFormFieldName]['vDEF'];
                 } else {