Forum OpenACS Development: Re: Re: ad_form and [] in options

Collapse
Posted by Malte Sussdorff on
Sure. Here you go:
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]]]
}
And the issue is that $title can have the values:
  • myfile[1].doc or
  • myfile{1}.doc or
  • my$file.doc
Collapse
Posted by Dave Bauer on
Malte

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.