option elements have a selected attribute which is boolean like 'checked'. However, setting it currently requires a workaround like using std:if with two versions of the option.
This ticket will add a new standard 'selected' component.
The cleaner way to handle this is to use the existing html:bidir-value on the parent select element. Then there is no need to manipulate the selected attribute on options. For example:
<select html:bidir-value='myProperty'>
binds the JavaBeans property 'myProperty' to the select. The value is fetched via getMyProperty() for rendering, and when the selected value changes, setMyProperty is called.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The cleaner way to handle this is to use the existing html:bidir-value on the parent select element. Then there is no need to manipulate the selected attribute on options. For example:
binds the JavaBeans property 'myProperty' to the select. The value is fetched via getMyProperty() for rendering, and when the selected value changes, setMyProperty is called.