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, 10 years ago) (diff)


Selecting a HTML option

From the mailing list ...

On 11/2/05, Jaime Wyant <…> 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 py:if="not $character.ascended" name="ascended">
    <option  value="True">True</option>
    <option value="False" selected="selected">False</option>

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>