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 -N -r1.56 -r1.57 --- openacs-4/packages/acs-tcl/tcl/form-processing-procs.tcl 12 Oct 2006 07:53:20 -0000 1.56 +++ openacs-4/packages/acs-tcl/tcl/form-processing-procs.tcl 1 Nov 2006 19:12:54 -0000 1.57 @@ -738,6 +738,9 @@ template::element create $form_name __refreshing_p -datatype integer -widget hidden -value 0 + # add the hidden button element + template::element create $form_name "__submit_button_name" -datatype text -widget hidden -value "" + template::element create $form_name "__submit_button_value" -datatype text -widget hidden -value "" } if { [info exists export] } { @@ -1008,6 +1011,7 @@ # Get all the form elements. We can't call form get_values because it doesn't handle multiples # in a reasonable way. + foreach element_name $properties(element_names) { if { [info exists af_flag_list(${form_name}__$element_name)] && \ [lsearch $af_flag_list(${form_name}__$element_name) multiple] >= 0 } { @@ -1019,6 +1023,13 @@ } } + # Update the clicked button if it does not already exist + uplevel #$level { + if {![exists_and_not_null ${__submit_button_name}]} { + set ${__submit_button_name} ${__submit_button_value} + } + } + if { [info exists key_name] } { upvar #$level $key_name __key upvar #$level __key_signature __key_signature Index: openacs-4/packages/acs-tcl/tcl/tcl-documentation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/tcl-documentation-procs.tcl,v diff -u -N -r1.20 -r1.21 --- openacs-4/packages/acs-tcl/tcl/tcl-documentation-procs.tcl 4 Jun 2006 00:45:47 -0000 1.20 +++ openacs-4/packages/acs-tcl/tcl/tcl-documentation-procs.tcl 1 Nov 2006 19:12:54 -0000 1.21 @@ -853,6 +853,11 @@ # This is the value set actual_value [ns_set value $form $form_counter_i] + # This is needed for double click protection so we can access the two variables down below. + if {$actual_name eq "__submit_button_name" || $actual_name eq "__submit_button_value"} { + set $actual_name $actual_value + } + # It may be a signature for another variable if { [regexp {^(.*):sig$} $actual_name match formal_name] } { set apc_signatures($formal_name) $actual_value @@ -1123,6 +1128,13 @@ ad_script_abort } } + + # Set the __submit_button_variable. This is used in double click protection. + if {[exists_and_not_null __submit_button_name] && [info exists __submit_button_value]} { + uplevel 1 [list set $__submit_button_name $__submit_button_value] + } + + } ad_proc -public ad_page_contract_get_variables { } {