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

Collapse
Posted by Dave Bauer on
Malte,

Can we see the exact call to ad_form that is causing the problem? I am not sure if you pass a reglar variable that it will call the subst on the value of the variable, or the name of the variable. So please provide a reproducible example we can discuss.

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.