Index: openacs-4/packages/acs-templating/tcl/element-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/element-procs.tcl,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/acs-templating/tcl/element-procs.tcl 24 Sep 2002 09:06:04 -0000 1.9 +++ openacs-4/packages/acs-templating/tcl/element-procs.tcl 2 Jan 2003 17:11:09 -0000 1.10 @@ -122,11 +122,15 @@ variable defaults array set opts $defaults - template::util::get_opts $args + # By default, the form/edit mode is set to the empty string + # Can be set to something else if you want + set opts(mode) {} # set the form section set opts(section) $form_properties(section) + template::util::get_opts $args + # set a name if none specified if { ! [info exists opts(name)] } { set opts(name) $opts(id) } @@ -151,8 +155,16 @@ # check for submission if { [template::form is_submission $form_id] || [info exists opts(param)] } { validate $form_id $element_id - } + } elseif { ![empty_string_p [ns_queryget "__edit"]] } { + # If the magic __edit button was hit, try to get values from the form still + # but don't do any validation + set opts(values) [querygetall opts] + # be careful not to clobber a default value if one has been specified + if { [llength $opts(values)] || ! [info exists opts(value)] } { + set opts(value) [lindex $opts(values) 0] + } + } } ad_proc -public template::element::set_properties { form_id element_id args } { @@ -360,6 +372,7 @@ if { ! [eval $v_code] } { # value is invalid according to custom validation code + # Do some expansion on $value, ${value}, $label, and ${label} lappend v_errors [string map [list \$value $value \${value} $value \$label $label \${label} $label] $v_message] set formerror($element_id:$v_name) [lindex $v_errors end] }