Project

General

Profile

Actions

Bug #64057

closed

Checkbox viewhelper checked attribute not set for objects

Added by Mathias Brodala over 9 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Must have
Category:
Fluid
Target version:
Start date:
2014-12-30
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
No
Sprint Focus:
Stabilization Sprint

Description

Given a form object with a property which may contain a list of objects (array/ObjectStorage) as well as a list of checkboxes built from all available objects for that property:

<f:form object="{object}" name="object">
  <f:for each="{availableObjects}" as="availableObject">
    <f:form.checkbox
      property="foo" 
      value="{availableObject}" 
      multiple="1"/>
  </f:for>
</f:form>

If you select one of the options, the checked attribute is not properly set on the subsequent form display. This is due to the fact that the CheckboxViewHelper converts the incoming value for the value attribute to an identifier through AbstractFormFieldViewHelper::getValue() but does not do the same for the property value. Thus e.g. an UID like 42 is searched in an array of objects which will never succeed. (Source)

A possible fix is to run PersistenceManager->getIdentifierByObject on each value within property too, thus comparing e.g. an UID with an array of UIDs. This is the same what AbstractFormFieldViewHelper::getValue() does when $convertObjects is set to TRUE (default).


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Feature #62436: Checkbox checked when Object has multiple values from a m:n related tableClosed2014-10-23

Actions
Related to TYPO3 Core - Bug #61099: CheckboxViewhelper and ObjectsClosed2014-08-20

Actions
Actions

Also available in: Atom PDF