Forum OpenACS Q&A: Combo box with the data from db

Collapse
Posted by Aash SH on
Can anybody here tell me why these simple codes don't seems to work? I need to have my combobox (Supervisor) comes from the list from rpt_supervisor table. But what has came out is the '$query_sup' itself in my combo box instead of the list of the data. These are the codes.

set query_sup [db_list_of_lists sup_loop "select sup_fullname, sup_id from rpt_supervisor"]

form create add_project -elements {
project_sup -label "Supervisor" -datatype text -widget select \
-options {$query_sup}
}

Why my-$query_sup variable is not read as the variable but then it is displayed as if only a normal string. Did I missed something there?

Thnx in advance.

Collapse
Posted by Matthew Geddert on

I would assume that the form proc doesn't work because {$query_sub} is within curly braces and that is not evaluated and substed by the form proc. If you remove the curly braces around $query_sup that might do it... If that doesn't do it, this should work:

set query_sup [db_list_of_lists sup_loop "select sup_fullname, sup_id from rpt_supervisor"]

ad_form create -name "add_project" -form {
   {project_sub:text(select) {label "Supervisor"} {options $query_sup}}
} -on_request {
} -on_submit {
}