diff --git a/extension/Classes/Core/AbstractBuildForm.php b/extension/Classes/Core/AbstractBuildForm.php index 71ab40537c414bc04defed5c87f7c0bd4efb01e4..67a7e2f7623e70bb1398cc30f5b6cfa6e867f609 100644 --- a/extension/Classes/Core/AbstractBuildForm.php +++ b/extension/Classes/Core/AbstractBuildForm.php @@ -2257,6 +2257,8 @@ abstract class AbstractBuildForm { if ($formElement[FE_MODE] == FE_MODE_READONLY) { $checkboxClass .= ' qfq-disabled'; // necessary for own style checkboxes to display them 'disabled' } + // Used in getFormElementForJson() for dynamic update. + $formElement['_checkboxClass'] = $checkboxClass; $br = ''; @@ -2265,7 +2267,8 @@ abstract class AbstractBuildForm { $jsonValue = false; $attribute = $attributeBase; $htmlFormElementNameUniq = HelperFormElement::prependFormElementNameCheckBoxMulti($htmlFormElementName, $ii, true); - $attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID] . '-' . $ii); + $checkboxId = $this->checkboxRadioOptionId($formElement[FE_HTML_ID], $ii); + $attribute .= Support::doAttribute('id', $checkboxId); $attribute .= Support::doAttribute('name', $htmlFormElementNameUniq); $attribute .= Support::doAttribute(ATTRIBUTE_DATA_REFERENCE, $formElement[FE_DATA_REFERENCE] . '-' . $ii); @@ -2294,7 +2297,8 @@ abstract class AbstractBuildForm { // $htmlElement = Support::wrapTag('<label>', $htmlElement); // } - $htmlElement = Support::wrapTag("<label class='$checkboxClass' $attributeBaseLabel>", $htmlElement, true); + $checkboxLabelId = $this->checkboxRadioOptionId($formElement[FE_HTML_ID], $ii, 'l'); + $htmlElement = Support::wrapTag("<label class='$checkboxClass' $attributeBaseLabel id='$checkboxLabelId'>", $htmlElement, true); // control orientation if ($formElement[FE_MAX_LENGTH] > 1) { @@ -2315,6 +2319,23 @@ abstract class AbstractBuildForm { return $html; } + /** + * Construct HTML ID for checkbox/radio option elements. + * Optional add $type. + * Example: $base='173-21612-1-0', $index='0', $type='l' >> '173-21612-1-0-0-l' + * + * @param $base + * @param $index + * @param string $type - ';' for label + * @return string + */ + private function checkboxRadioOptionId($base, $index, $type = '') { + if ($type != '') { + $type = '-' . $type; + } + return $base . '-' . $index . $type; + + } /** * Submit extra (hidden) values by SIP. *