Re: How do I use selected/checked ?

Chris Croome <chris-u/[email protected]>
Newsgroups gmane.comp.lang.perl.modules.petal
Message-ID <[email protected]>
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>

Chris

-- 
Chris Croome                               <chris-u/[email protected]>
web design                             http://www.webarchitects.co.uk/ 
web content management                               http://mkdoc.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.