Hello,
I am trying to create an ad_form that has one or more text input fields that can be created depending on the number of requirements pulled from the database.
so far i am pulling the number of text input fields needed for ad_form with a db_multirow and using var_name:rowcount to see how many text fields i will need, but var_name:rowcount will not work as the variable in a for statement and
set var var_name:rowcount
will not work either. The result is var is set to the text value var_name:rowcount.
any ideas?
thanks
here is my code:
db_multirow -unclobber -local -append evalu query {
SELECT req_bank_id
FROM jobs_req_map
WHERE position_id=:position_id
}
set form { eval_id:key(jobs_eval_id_seq)}
set num2 0
set row 3
for {set i 0} {$i < $row} {incr i} {
# incr $num2
lappend form {
{req$num2:text(text)
{label "Requirement Score"}
}
}
}
ad_form -name evals \
-cancel_url index \
-form { eval_id:key(jobs_eval_id_seq)
{req$num2:text(select)
{label "Requirement Score $num2"}
{options {{"" } {"5" 5} {"4" 4} {"3" 3} {"2" 2} {"1" 1} {"0" 0}}}
} } \
-new_data {
} -after_submit {
ad_returnredirect index
}
#{ eval_id:key(jobs_eval_id_seq)
# {req$num:text(select)
# {label "Requirement Score $num"}
# {options {{"" } {"5" 5} {"4" 4} {"3" 3} {"2" 2} {"1" 1} {"0" 0}}}
# } } \