[FLOW3-general] Fluid: preselection with a multiple form.select with a M:N relation

Matthias Habegger theis_mh at gmx.ch
Tue Nov 29 14:40:23 CET 2011


Hallo Ivan,

thank you for your reply, my problem got solved by flow3 1.0.1.

Look at http://flow3.typo3.org/documentation/guide/partv/changelogs/101.html

Regards,
Matthias

Am 23.11.2011 08:55, schrieb Ivan Ruiz Gallego:
> Hi Matthias,
>
> If you want to preselect one of the select options you will need in most
> cases to set the attribute value to that object. So something like this:
>
> <f:form.select property="categories" options="{allCategories}"
> value="{preselectedCategory}" />
>
> If the option to be preselected results from from validation, FLOW3 will
> preselect it. So in that case you don't need to set the value.
>
> Regards,
> Ivan.
>
> On 18.11.2011 15:13, Matthias Habegger wrote:
>> Hallo,
>>
>> I have a M:N relation between my two models "book" and "category".
>>
>>
>> Now I try to create a multiple select with the SelectViewHelper like
>> that:
>> --
>> <f:form.select property="categories" options="{categories}"
>> optionLabelField="name" multiple="multiple" size="7" />
>> --
>>
>>
>> {categories} is a variable assigned in the controller.
>> --
>> $this->view->assign('categories', $this->categoryRepository->findAll());
>> --
>> that works fine, all, categories are shown in the select.
>>
>>
>> The problem is, that none of my preselected categories are selected.
>>
>> The html output looks like that:
>> --
>> <input type="hidden" name="book[categories]" value="" />
>> <select id="categories" multiple="multiple" size="7"
>> name="book[categories][]">
>> <option value="0bc305ec-8aff-4fa8-bdeb-476d7c21c841">Novels</option>
>> <option value="8c2221e3-a3fd-4ce2-8f7e-66aac9eed5f5">Second
>> Category</option>
>> <option value="c1ca0c2d-08c4-4b22-b9c7-69bbd42de840">Third
>> category</option>
>> </select>
>> --
>>
>>
>> What shall I do to get the preselection work
>>
>> Greetings
>> Matthias
>



More information about the FLOW3-general mailing list