Forum OpenACS Q&A: Using multirow data source in form template

I guess I am missing something, but I can't seem to figure out how to incorporate a multirow data source into a form tamplate.

What I am looking for is something along the lines of:

db_multirow category category_qry {
        select option_name
        from params
        where param_id='category'
}

form create test_form

element create test_form category 
        -label "Category" 
        -datatype text -widget select 
        -options category_qry

How do I get the results of category_qry to be used as a list source for -widget select in the form?

Collapse
Posted by Andrei Popov on
Ok, a bit more tinkering/RTFMing and the correct thing to do is:
set category [
    db_list category_qry {
        select option_name
        from params
        where param_id='category'
    }
]

form create test_form

element create test_form category 
        -label "Category" 
        -datatype text -widget select 
        -options $category