[albatross-users] Limitations of al-select and al-option

Sheila King sheila at thinkspot.net
Tue Sep 30 12:50:01 EST 2003


--On Tuesday, September 30, 2003 11:43 AM +1000 Dave Cole 
<djc at object-craft.com.au> wrote:

> Have a closer look at the second example on this page:
>
>
> http://www.object-craft.com.au/projects/albatross/albatross/tag-select-op
> tionexpr.html
>
> Unless I misunderstand what you are asking, it does exactly what you
> require.

I knew it had to be me not catching on, as it just seemed so obvious 
someone would want that functionality. I do not know HOW I missed that 
second example previously, as I reviewed that page more than once. :/

Thank you very much for your prompt reply. You are right, that example does 
do exactly what I want. :)


-- 
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org


>> (2) I can't use an al-for to generate this either, as the al-select
>> tag ignores any al-option tags that are not "direct children" of the
>> al-select tag.
>>
>> So it appears that I cannot generate HTML code such as:
>>
>> <select name="mymenuname">
>> <option value="1">option 1</option>
>> <option value="2">option 2</option>
>> <option value="3">option 3</option>
>> </select>
>>
>> If I'm missing something, and there is a way to generate HTML as shown
>> above, please clue me in. Right now I'm getting around this by making
>> extra MySQL queries to convert the text "option 1" into the integer
>> value that I would really like the form to return for me.
>
> What you need to do is something similar to this in your Python code:
>
>     c.execute('SELECT id, name FROM category')
>     ctx.locals.optionlist = c.fetchall()
>     ctx.run_template('something.html')
>
> When the <al-select> tag sees that each item in the option list is a
> tuple it treats item differently.  It uses the first element of each
> tuple as the option value and the second element as the content.
>
> - Dave








More information about the Albatross-users mailing list