[Petal] How do I use selected/checked ?

jonathan vanasco jvanasco at mastersofbranding.com
Wed Aug 31 14:31:21 BST 2005


OK. that makes perfect sense.

thats in the docs, but unexplained, so i didn't know what to look for  
in that example.



On Aug 31, 2005, at 3:55 AM, Chris Croome wrote:

> Hi
>
> On Wed 31-Aug-2005 at 12:56:59AM -0400, Jonathan Vanasco wrote:
>
>> I'm a moron and I can't figure this out.
>>
>> I know that to be xhtml compliant it must be
>>     selected="selected"
>>     checked="checked"
>>
>> that's fine.
>>
>> what I can't figure out is how to structure that in petal.
>>
>
> The way I do it is by repeating the option element, at first this
> seems a bit off but it's OK since it actually makes the template
> more like the actual page when it's being developed and tested, for
> example this is how the select list for the language of a document
> is generated for MKDoc:
>
>   <select
>     name="lang"
>     id="lang"
>     class="select"
>     title="Select the language."
>
>>
>>
>     <option
>       value="en"
>       title="en"
>       selected="selected"
>       petal:condition="true: self/selected_lang"
>       petal:attributes="value self/selected_lang/value;
>                         title self/selected_lang/value;"
>       petal:content="self/selected_lang/label"
>
>> English</option>
>>
>     <option
>       value="i-klingon"
>       title="i-klingon"
>       petal:repeat="lang self/unselected_langs"
>       petal:attributes="value lang/value;
>                         title lang/value;"
>       petal:content="lang/label"
>
>> Klingon</option>
>>
>   </select>



More information about the Petal mailing list