Index: openacs-4/packages/acs-templating/tcl/form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/form-procs.tcl,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/acs-templating/tcl/form-procs.tcl 2 Jan 2003 17:11:09 -0000 1.9 +++ openacs-4/packages/acs-templating/tcl/form-procs.tcl 9 Jan 2003 11:55:09 -0000 1.10 @@ -70,6 +70,14 @@ template::util::get_opts $args + if { [exists_and_not_null opts(cancel_url)] && ![exists_and_not_null opts(cancel_label)] } { + set opts(cancel_label) "Cancel" + } + + if { [exists_and_not_null opts(cancel_url)] } { + lappend opts(buttons) [list $opts(cancel_label) cancel] + } + set elements [list] # check whether this form is being submitted @@ -82,6 +90,12 @@ set submission [string equal $id [ns_queryget form:id]] } + if { $submission && ![empty_string_p [ns_queryget "cancel"]] && [exists_and_not_null opts(cancel_url)]} { + # If the user hit a button named "cancel", + ad_returnredirect $opts(cancel_url) + ad_script_abort + } + if { ![empty_string_p [ns_queryget "__edit"]] } { # The magic button named __edit means we should now be in edit mode set submission 0 Index: openacs-4/packages/acs-templating/www/doc/demo/display-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/demo/display-edit.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/acs-templating/www/doc/demo/display-edit.tcl 2 Jan 2003 17:11:32 -0000 1.1 +++ openacs-4/packages/acs-templating/www/doc/demo/display-edit.tcl 9 Jan 2003 11:55:24 -0000 1.2 @@ -2,15 +2,14 @@ @cvs-id $Id$ } { {grid ""} - cancel:optional } -properties {} if { [info exists cancel] } { ad_returnredirect [ad_conn url] ad_script_abort } -form create sandwich -mode display +form create sandwich -mode display -cancel_url [ad_conn url] element create sandwich grid \ -label "grid" -optional \