Index: openacs-4/packages/acs-tcl/tcl/form-processing-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/form-processing-procs.tcl,v
diff -u -r1.27 -r1.28
--- openacs-4/packages/acs-tcl/tcl/form-processing-procs.tcl 18 Feb 2003 12:13:49 -0000 1.27
+++ openacs-4/packages/acs-tcl/tcl/form-processing-procs.tcl 19 Feb 2003 15:05:29 -0000 1.28
@@ -183,9 +183,16 @@
-edit_request
A code block which sets the values for each element of the form meant to be modifiable by the user. Use
- this when a single query to grab database values is insufficient.
+ this when a single query to grab database values is insufficient. You just need to set the values as local
+ variables in the code block, and they'll get fetched and used as element values for you.
+ -new_request
+
A code block which initializes elements for a new row. Use this to set default values.
+ You just need to set the values as local
+ variables in the code block, and they'll get fetched and used as element values for you.
+
+
-confirm_template
The name of a confirmation template to be called before any on_submit, new_data or edit_data block. When
the user confirms input control will be passed to the appropriate submission block. The confirmation
@@ -787,6 +794,14 @@
if { [info exists new_request] } {
ad_page_contract_eval uplevel #$level $new_request
+ # LARS: Set form values based on local vars in the new_request block
+ foreach element_name $af_element_names($form_name) {
+ if { [llength $element_name] == 1 } {
+ if { [uplevel \#$level [list info exists $element_name]] } {
+ set values($element_name) [uplevel \#$level [list set $element_name]]
+ }
+ }
+ }
}
}