Hmm, I'm not 100% sure I understand but this is something that I use
to populate a select drop-down from a list:
${ h.select(name='selectedItem',
option_tags=h.options_for_select(c.list, selected=None),
selected=None, multiple=False ) }
On Tue, May 20, 2008 at 11:40 AM, Joe Riopel <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I am new to pylons and have a question about using the h.select(). I
> have a list of objects that are accessible in the form as
> "c.type_list". I want to use the elements in that list to populate the
> h.select(). However, I am unsure how to specify the value of each
> option and the text to use for each option in the select.
>
> I do have it working, but it doesn't seem right. Here is what I have right
> now:
>
> ${h.select('lbxType', ''.join(map(lambda ct: '<option
> value=\"%d\">%s</option>' % (ct.id, ct.name,), c.type_list)))}
>
>
> As you can see, I am using the id property of the object for the
> option value, and the name property as the option text. Is there a
> cleaner way to do this using the webhelpers module?
>
> Thanks,
> Joe
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---