[BUGFIX] EXT:form - Wrong radio/ checkbox handling if no value is set 07/43707/3
authorRalf Zimmermann <ralf.zimmermann@tritum.de>
Thu, 1 Oct 2015 15:52:52 +0000 (17:52 +0200)
committerFrans Saris <franssaris@gmail.com>
Fri, 2 Oct 2015 13:25:18 +0000 (15:25 +0200)
Do not mark a radio or checkbox as selected, if no "value" property
is set within the configuration and no incoming data exists.

Resolves: #70278
Releases: master
Change-Id: I5d9b1344d1581fb42b9d39bf0834a62fe56d252d
Reviewed-on: http://review.typo3.org/43707
Reviewed-by: Bjoern Jacob <bjoern.jacob@tritum.de>
Tested-by: Bjoern Jacob <bjoern.jacob@tritum.de>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Josef Glatz <jousch@gmail.com>
Tested-by: Josef Glatz <jousch@gmail.com>
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Frans Saris <franssaris@gmail.com>
typo3/sysext/form/Classes/Hooks/HandleIncomingFormValues.php

index baedc00..06a867f 100644 (file)
@@ -72,7 +72,7 @@ class HandleIncomingFormValues implements SingletonInterface {
                                }
                        } else {
                                if (
-                                       $incomingData === $modelValue
+                                       (!empty($modelValue) && $incomingData === $modelValue)
                                        || $incomingData === $incomingName . '-' . $element->getElementCounter()
                                ) {
                                        $this->setAttribute($element, 'checked', 'checked');
@@ -98,7 +98,7 @@ class HandleIncomingFormValues implements SingletonInterface {
                        $checked = FALSE;
                        $incomingData = $formBuilder->getIncomingData()->getIncomingField($incomingName);
                        if (
-                               $incomingData === $modelValue
+                               (!empty($modelValue) && $incomingData === $modelValue)
                                || $incomingData === $incomingName . '-' . $element->getElementCounter()
                        ) {
                                $this->setAttribute($element, 'checked', 'checked');