ad_import_dynamic_form_vars

EveAndersson.com : API Browser : ad_import_dynamic_form_vars

ad_import_dynamic_form_vars (public)

ad_import_dynamic_form_vars [ -array array ] [ -index index ] \
    [ -set_vars ]
Defined in packages/acs-core/utilities-procs.tcl

Searches through an array specified by -array for dynamic form variables and converts to a list of key/value pairs, optionally setting the variables in the caller's environment. The returned list matches the input to ad_export_dynamic_form_vars from the calling page. To use this function, add a variable to the ad_page_contract on the page that is receiving the form variables called dynamic_vars that is flagged:array,multiple,optional. Alternatively, you can use whatever name you want, but be to sure to specify that by using the -array flag. Then in the body of the page, call this function to get back the list of key value pairs.

Example:


set page_content ""
# We have an ad_page_contract with dynamic_vars:array,multiple,optional defined
set dynamic_list [ad_import_dynamic_form_vars -set_vars]
append page_content "Retrieving dynamic form variables for $user_name:
" foreach item $dynamic_list { append page_content "Key: [lindex $item 0] ; Value: [lindex $item 1]
" } append page_content "

We used -set_vars so the vars are declared in the enviroment as well.
" foreach item $dynamic_list { append page_content "The value of [lindex $item 0] is [subst $[lindex $item 0]].
" } doc_return 200 text/html $page_content

Switches:
-array (defaults to "dynamic_vars") - The base name of the dynamic form variables.
-index (optional) - An optional list of the form (array_name var1 ... varN) where array_name is a name of an array variable var1 through varN are the indices into the array. If this is specified, variables of the form array_name(var1) are accumulated in the list to be returned. This is useful if the incoming form variables are genearted from <INPUT> tags in the HTML form in which case ad_export_dynamic_form_variables cannot be used. -array is ignored if you specify this flag.
-set_vars (boolean) - If set, all of the dynamic variables will be set in the page's environment overwriting previous values.
Author:
Bryan Quinn
[ show source ]

Show another procedure:

eve@eveandersson.com