if {$parent_id == $root_folder_id} { lappend files [list "$title ($content_size bytes)" $object_id] } else { lappend files [list "$title ($content_size bytes) ($foldername)" $object_id] } ad_form -extend -name freelancer -form [list [list file_ids.${folder}:text(checkbox),multiple,optional [list label "[_ mypack.Folder] $folder_name"] [list options $files]]] }
This would solve your problem:
ad_form -extend -name freelancer -form { {file_ids.${folder}:text(checkbox),multiple,optional [list label "[_ mypack.Folder] $folder_name"] [list options $files]}}
and be alot simpler than rewriting ad_form.
Using curly braces delays the evaluation you are actually passing the value of the options variable to ad_form instead of the name.