Re: option selected

Chris Croome <chris-u/[email protected]>
Newsgroups gmane.comp.lang.perl.modules.petal
Message-ID <[email protected]>
Hi

On Sat 18-Dec-2004 at 09:07:54PM -0000, Simon McCaughey wrote:
> I can't seem to get a reasonable solution to the option selected
> problem

Yeah, this is confusing at first, basically you need to have two
option elements, something like this:

  <select 
    title="Select a language for the document."
  >
    <option
      selected="selected"
      petal:attributes="value self/selected_lang/value"
      petal:content="self/selected_lang/label"
    >English</option>
    <option
      value="i-klingon"
      petal:repeat="lang self/unselected_langs;"
      petal:attributes="value lang/value"
      petal:content="lang/label"
    >Klingon</option>
  </select>
  
Here the first <option> element is used for the selected item and
then there is a loop through the unselected ones.

I have never worked out how to do it any other way, but doing it
this way is good for when the unprocessed templates are opened in a
web browser, just like the table row example from a few days ago. 

I *think* there was a MKDoc site for Petal at one stage, but now
http://petal.mkdoc.com/ doesn't seem to exist -- perhaps we should
set up a site and use it for example like this? Or we could create a
/petal/ section on mkdoc.org for this...

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.