[BUGFIX] EXT:form - Wrong Checkbox and Radiobutton handling 43/43543/3
authorRalf Zimmermann <ralf.zimmermann@tritum.de>
Thu, 24 Sep 2015 20:54:35 +0000 (22:54 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Mon, 28 Sep 2015 15:36:57 +0000 (17:36 +0200)
Resolves: #70095
Releases: master
Change-Id: I55ba94d13a8aeb02858675d2924f1d8a75cea698
Reviewed-on: http://review.typo3.org/43543
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Bjoern Jacob <bjoern.jacob@tritum.de>
Tested-by: Bjoern Jacob <bjoern.jacob@tritum.de>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
typo3/sysext/form/Classes/Hooks/HandleIncomingFormValues.php
typo3/sysext/form/Resources/Private/Partials/Compatibility/Confirmation/FlatElements/Checkbox.html
typo3/sysext/form/Resources/Private/Partials/Compatibility/Confirmation/FlatElements/Radio.html
typo3/sysext/form/Resources/Private/Partials/Compatibility/Show/FlatElements/Checkbox.html
typo3/sysext/form/Resources/Private/Partials/Compatibility/Show/FlatElements/Radio.html
typo3/sysext/form/Resources/Private/Partials/Default/Confirmation/FlatElements/Checkbox.html
typo3/sysext/form/Resources/Private/Partials/Default/Confirmation/FlatElements/Radio.html
typo3/sysext/form/Resources/Private/Partials/Default/Show/FlatElements/Checkbox.html
typo3/sysext/form/Resources/Private/Partials/Default/Show/FlatElements/Radio.html

index ac5f56e..b132fec 100644 (file)
@@ -71,7 +71,10 @@ class HandleIncomingFormValues implements SingletonInterface {
                                        $this->setAttribute($element, 'checked', NULL);
                                }
                        } else {
-                               if ($incomingData === $modelValue) {
+                               if (
+                                       $incomingData === $modelValue
+                                       || $incomingData === $incomingName . '-' . $element->getElementCounter()
+                               ) {
                                        $this->setAttribute($element, 'checked', 'checked');
                                        $checked = TRUE;
                                } else {
@@ -94,7 +97,10 @@ class HandleIncomingFormValues implements SingletonInterface {
                        }
                        $checked = FALSE;
                        $incomingData = $formBuilder->getIncomingData()->getIncomingField($incomingName);
-                       if ($incomingData === $modelValue) {
+                       if (
+                               $incomingData === $modelValue
+                               || $incomingData === $incomingName . '-' . $element->getElementCounter()
+                       ) {
                                $this->setAttribute($element, 'checked', 'checked');
                                $checked = TRUE;
                        } else {
index 218f055..efc41fa 100644 (file)
@@ -20,7 +20,7 @@
                                onclick="{model.additionalArguments.onclick}"
 
                                name="{model.additionalArguments.prefix}[{model.additionalArguments.name}][{model.name}]"
-                               value="{model.additionalArguments.value}"
+                               value="<f:if condition='{model.additionalArguments.value}'><f:then>{model.additionalArguments.value}</f:then><f:else>{model.additionalArguments.name}-{model.elementCounter}</f:else></f:if>"
 
                                additionalAttributes="{model.htmlAttributes}"
                        />
index 1c18e38..97e6dcc 100644 (file)
@@ -18,7 +18,7 @@
                onclick="{model.additionalArguments.onclick}"
 
                name="{model.additionalArguments.prefix}[{model.additionalArguments.name}]"
-               value="{model.additionalArguments.value}"
+               value="<f:if condition='{model.additionalArguments.value}'><f:then>{model.additionalArguments.value}</f:then><f:else>{model.additionalArguments.name}-{model.elementCounter}</f:else></f:if>"
 
                additionalAttributes="{model.htmlAttributes}"
        />
index 33663b9..87bd14e 100644 (file)
@@ -14,7 +14,7 @@
                                        onclick="{model.additionalArguments.onclick}"
 
                                        name="{model.additionalArguments.prefix}[{model.additionalArguments.name}][{model.name}]"
-                                       value="{model.additionalArguments.value}"
+                                       value="<f:if condition='{model.additionalArguments.value}'><f:then>{model.additionalArguments.value}</f:then><f:else>{model.additionalArguments.name}-{model.elementCounter}</f:else></f:if>"
 
                                        checked="{model.additionalArguments.checked}"
 
@@ -35,7 +35,7 @@
                                        onclick="{model.additionalArguments.onclick}"
 
                                        name="{model.additionalArguments.prefix}[{model.additionalArguments.name}]"
-                                       value="{model.additionalArguments.value}"
+                                       value="<f:if condition='{model.additionalArguments.value}'><f:then>{model.additionalArguments.value}</f:then><f:else>{model.additionalArguments.name}-{model.elementCounter}</f:else></f:if>"
 
                                        checked="{model.additionalArguments.checked}"
 
@@ -45,4 +45,4 @@
                        </f:else>
                </f:if>
        <f:format.raw>{model.layout.elementOuterWrap.1}</f:format.raw>
-</f:if>
\ No newline at end of file
+</f:if>
index 7242f99..d7fda48 100644 (file)
@@ -12,7 +12,7 @@
                        onclick="{model.additionalArguments.onclick}"
 
                        name="{model.additionalArguments.prefix}[{model.additionalArguments.name}]"
-                       value="{model.additionalArguments.value}"
+                       value="<f:if condition='{model.additionalArguments.value}'><f:then>{model.additionalArguments.value}</f:then><f:else>{model.additionalArguments.name}-{model.elementCounter}</f:else></f:if>"
 
                        checked="{model.additionalArguments.checked}"
 
index 5452eb9..a22276f 100644 (file)
@@ -21,7 +21,7 @@
                                onclick="{model.additionalArguments.onclick}"
 
                                name="{model.additionalArguments.prefix}[{model.additionalArguments.name}][{model.name}]"
-                               value="{model.additionalArguments.value}"
+                               value="<f:if condition='{model.additionalArguments.value}'><f:then>{model.additionalArguments.value}</f:then><f:else>{model.additionalArguments.name}-{model.elementCounter}</f:else></f:if>"
 
                                additionalAttributes="{model.htmlAttributes}"
                        />
@@ -39,7 +39,7 @@
                                onclick="{model.additionalArguments.onclick}"
 
                                name="{model.additionalArguments.prefix}[{model.additionalArguments.name}]"
-                               value="{model.additionalArguments.value}"
+                               value="<f:if condition='{model.additionalArguments.value}'><f:then>{model.additionalArguments.value}</f:then><f:else>{model.additionalArguments.name}-{model.elementCounter}</f:else></f:if>"
 
                                additionalAttributes="{model.htmlAttributes}"
                        />
index 181cdc7..dc584e6 100644 (file)
@@ -19,7 +19,7 @@
                onclick="{model.additionalArguments.onclick}"
 
                name="{model.additionalArguments.prefix}[{model.additionalArguments.name}]"
-               value="{model.additionalArguments.value}"
+               value="<f:if condition='{model.additionalArguments.value}'><f:then>{model.additionalArguments.value}</f:then><f:else>{model.additionalArguments.name}-{model.elementCounter}</f:else></f:if>"
 
                additionalAttributes="{model.htmlAttributes}"
        />
index 6d44e2e..cd702e6 100644 (file)
@@ -24,7 +24,7 @@
                                        onclick="{model.additionalArguments.onclick}"
 
                                        name="{model.additionalArguments.prefix}[{model.additionalArguments.name}][{model.name}]"
-                                       value="{model.additionalArguments.value}"
+                                       value="<f:if condition='{model.additionalArguments.value}'><f:then>{model.additionalArguments.value}</f:then><f:else>{model.additionalArguments.name}-{model.elementCounter}</f:else></f:if>"
 
                                        checked="{model.additionalArguments.checked}"
 
@@ -45,7 +45,7 @@
                                        onclick="{model.additionalArguments.onclick}"
 
                                        name="{model.additionalArguments.prefix}[{model.additionalArguments.name}]"
-                                       value="{model.additionalArguments.value}"
+                                       value="<f:if condition='{model.additionalArguments.value}'><f:then>{model.additionalArguments.value}</f:then><f:else>{model.additionalArguments.name}-{model.elementCounter}</f:else></f:if>"
 
                                        checked="{model.additionalArguments.checked}"
 
index 63ee6c9..e3df135 100644 (file)
@@ -22,7 +22,7 @@
                        onclick="{model.additionalArguments.onclick}"
 
                        name="{model.additionalArguments.prefix}[{model.additionalArguments.name}]"
-                       value="{model.additionalArguments.value}"
+                       value="<f:if condition='{model.additionalArguments.value}'><f:then>{model.additionalArguments.value}</f:then><f:else>{model.additionalArguments.name}-{model.elementCounter}</f:else></f:if>"
 
                        checked="{model.additionalArguments.checked}"