Forum OpenACS Q&A: Re: handling an ad_form values generated dynamically

Collapse
Posted by Dave Bauer on
The variables are not substituted at that level in ad_form You can build up the form definition as a list like this:
set form [list]
db_foreach my_query { *SQL* } {
    lappend form [list fte${grade_level_id}:naturalnum [list label $description] [list html [list size 5]] [list value $fte]]
}
Another trick you can use it to put the values into an array by using a . in the element name.
set form [list]
db_foreach my_query { *SQL* } {
    lappend form [list fte.${grade_level_id}:naturalnum [list label $description] [list html [list size 5]] [list value $fte]]
}
Then you can add fte:array,optional in ad_page_contract and an array named fte will be created with one element for each grade_level_id with the grade_level_id as the key.