I have a select field in a Fluid template with a lot of options that I need to organise into groups.
I see that I can do this with <f:form.select.optgroup>
, but is there a way to to use the f:form.select
options parameter to do this in a much tidier way?
I would expect something like:
<f:form.select
options="{
value1: 'Value 1',
value2: 'Value 2',
value3: 'Value 3',
{
'My Group':
{
value4: 'Value 4',
value5: 'Value 5',
value6: 'Value 6',
}
}
}
/>
You need to use the option viewhelper within the form.select body as children:
<f:form.select name="myproperty">
<f:form.select.option value="1">Option one</f:form.select.option>
<f:form.select.option value="2">Option two</f:form.select.option>
<f:form.select.optgroup>
<f:form.select.option value="3">Grouped option one</f:form.select.option>
<f:form.select.option value="4">Grouped option twi</f:form.select.option>
</f:form.select.optgroup>
</f:form.select>
Newer versions lacks the example as they are rendered form source code nower days. I guess that example may be back in the future.