TYPO3 fluid: <option> with dynamic selected attribute

revision 19d0d37a8e8c33398731183e70ad70f34207284c

raw

fluid.html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<html data-namespace-typo3-fluid="true"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
    xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers"
>
 
    <f:for each="{options}" as="optionObject">
        <f:variable name="optionAttributes" value="{value: optionObject.value}"/>
        <f:if condition="{optionObject.isSelected}">
            <v:variable.set name="optionAttributes.selected" value="selected"/>
        </f:if>
        <v:tag name="option" additionalAttributes="{optionAttributes}">{optionObject.label}</v:tag>
    </f:for>
 
</html>
 

History