5.2.4 <al-option>

Unless explicitly overridden, the selected attribute is controlled by the comparison of the value of the enclosing <al-select> (5.2.3) tag with the evaluated value of the <al-option> tag.

The value of the <al-option> tag is specified either by evaluating the valueexpr (5.2.4.2) attribute, or the value (5.2.4.1) attribute, or if neither attribute is present, by the content enclosed by the <al-option> tag. The enclosed content of the tag is evaluated before it is compared. This allows the content to be generated using other Albatross tags.

Albatross browser request merging depends upon the functionality provided by the <al-option> tag. If you do no use this tag in applications then the standard request merging will not work.

For example -- this shows how the <al-option> content is evaluated before it is compared with the <al-select> value:

>>> import albatross
>>> ctx = albatross.SimpleContext('.')
>>> ctx.locals.opt = 'spam'
>>> ctx.locals.sel = 'spam'
>>> albatross.Template(ctx, '<magic>', '''
... <al-select name="sel">
...  <al-option><al-value expr="opt"></al-option>
...  <al-option>eggs</al-option>
... </al-select whitespace>
... ''').to_html(ctx)
>>> ctx.flush_content()
<select name="sel"><option selected>spam</option><option>eggs</option></select>



Subsections