wiki:SelectingOption
Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Version 2 (modified by koorb, 9 years ago) (diff)

tidied

Selecting a HTML option

From the mailing list ...

On 11/2/05, Jaime Wyant <programmer.py@…> wrote:

<!--
     I want to `set' the selection based on the character.ascended expression.
    This just seems clunky.
-->
<select py:if="$character.ascended" name="ascended">
    <option  value="True" selected="selected">True</option>
    <option value="False">False</option>
</select>

<select py:if="not $character.ascended" name="ascended">
    <option  value="True">True</option>
    <option value="False" selected="selected">False</option>
</select>

Yes, that would be painful to have to do that everywhere... There was another thread on this recently, which shows that we need to add some documentation about this.

<select name="ascended">
   <option  value="True" py:attrs="selected=std.selector(character.ascended)">True</option>
   <option value="False" py:attrs="selected=std.selector(not character.ascended">False</option>
</select>