[FLOW3-general] Fluid: preselection with a multiple form.select with a M:N relation
Matthias Habegger
theis_mh at gmx.ch
Fri Nov 18 15:13:19 CET 2011
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