[MKDoc-dev] Events Component, pull down menus

Sam Tregar sam at tregar.com
Tue Oct 19 17:43:42 BST 2004


On Tue, 19 Oct 2004, Chris Croome wrote:

> Due to a bug with select lists in an old version of IE for Macs we
> have generally used a petal condition to find the <option> that
> should be the default (in this case the current month) and then
> added the selected="selected" attribute to this element and then
> follow this with a a loop through the other options.

I'm not sure I follow.  What bug are you refering to?  Can you show me
an example of the right way to do this?  

I spent an unfortunate amount of time getting the select lists to work
as they are due to my mistaken impression that browsers would do the
right thing with selected="0".  It seems that although XHTML requires
selected to have a value it doesn't matter what that value is!  I also
didn't realize that Petal would omit attributes set with undef, which
seems to be an undocumented but very useful feature.

Also, if I put the month names in the template how would you suggest I
loop through them?  I suppose I could resport to something like:

 <option value="01" title="01" i18n:translate="jan" petal:attributes="selected month/0/is_selected">January</option>
 <option value="01" title="01" i18n:translate="jan" petal:attributes="selected month/1/is_selected">January</option>

If I understand correctly this will index $month->[0]->{is_selected},
$month->[1]->{is_selected}, etc.

-sam


More information about the MKDoc-dev mailing list