Bug #5963

Multiple Select Form helper fails when value is Tx_Extbase_Persistence_ObjectStorage

Added by Nathan L about 12 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Won't have this time
Assignee:
-
Category:
ViewHelpers
Target version:
-
Start date:
2010-01-11
Due date:
% Done:

0%

Estimated time:
Has patch:

Description

<f:form.select multiple="true" size="4" property="dishTypes" options="{allDishTypes}" optionLabelField="name"></f:form.select>

This failed to mark selected items as selected when recipe->getDishTypes() returns a Tx_Extbase_Persistence_ObjectStorage

See the patch for the change I made to make it functional.

Basically the getOptions method converts the values away from objects.

Actually, this change I made should probably be done in getSelectedValue() but I have no time and have to catch my carpool.


Files

multiselect.patch (1.52 KB) multiselect.patch Nathan L, 2010-01-12 00:02
#1

Updated by Nathan L about 12 years ago

Ok, that patch was rushed out the door. Please ignore it.

After double checking things this morning, I found it works if I add:

<f:form.select multiple="true" size="4" property="dishTypes" options="{allDishTypes}" optionLabelField="name" optionValueField="uid"></f:form.select>

This seems ugly to me. I shouldn't have to reference the uid should I?

If a set of objects is passed as "value" to form.select without an optionValueField, it should default to the uid or throw an exception telling the developer to add optionValueField="uid" to the template. If this seems appropriate, then I'd be happy to offer a patch.

#2

Updated by Sebastian Kurfuerst over 11 years ago

  • Status changed from New to Closed
  • Priority changed from Should have to Won't have this time

please try again, I think actually that it automatically uses the UID if it sees instances of AbstractEntity/ValueObject.
And please re-open if needed :)

Greets,
Sebastian

Also available in: Atom PDF