Bug #5963

Multiple Select Form helper fails when value is Tx_Extbase_Persistence_ObjectStorage

Added by Nathan L over 5 years ago. Updated almost 5 years ago.

Status:Closed Start date:2010-01-11
Priority:Won't have this time Due date:
Assigned To:- % Done:

0%

Category:ViewHelpers
Target version:-
Has patch: Affected Flow version:

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.

multiselect.patch Magnifier (1.5 kB) Nathan L, 2010-01-12 00:02

History

#1 Updated by Nathan L over 5 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 about 5 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