[BUGFIX] Flexform Form ID should not contain brackets 98/54498/2
authorBenjamin Serfhos <serfhos@gmail.com>
Thu, 11 May 2017 12:30:15 +0000 (14:30 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Mon, 30 Oct 2017 20:20:14 +0000 (21:20 +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/54498
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/FlexFormElementContainer.php

index b986978..5826390 100644 (file)
@@ -110,8 +110,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 {