« Previous | Next » 

Revision dec3b187

IDdec3b187b6db773a5a84dec70918c22f428cb994

Added by Rens Admiraal over 9 years ago

[BUGFIX] Fix unusable checkbox/radio if formObject is NULL

When using a form object inside of a form view helper inside an index
action template and a checkbox is referring to a property $sth of
$someFormObject, the form object can be NULL with code like:

indexAction(\Some\Type $someFormObject = NULL){ ... }
<f:form ... object="{someFormObject}">
<f:form.checkbox property="{sth}" value="yes" checked="{sth.value} == yes"/>
</f:form>

Initially calling the index action makes someFormObject NULL. If the submitted
form had validation errors someFormObject is NULL, too. This possibility
was ignored in a call for the formObject from within the CheckboxViewHelper as
well as from the RadioViewHelper.

So you would get an exception telling you
No value found for key "TYPO3\Fluid\ViewHelpers\FormViewHelper->formObject"

This change fixes that bug and thus also sets the checkbox and radio
"checked" attribute properly when a validation error occurred.

Change-Id: I3d272504927fb9401e9cadc974b6b6c57ac08b6b
Fixes: #35894
Releases: 1.1, 1.2

  • added
  • modified
  • copied
  • renamed
  • deleted