Index: openacs-4/packages/acs-templating/tcl/widget-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/widget-procs.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/packages/acs-templating/tcl/widget-procs.tcl 13 Mar 2003 20:25:06 -0000 1.18 +++ openacs-4/packages/acs-templating/tcl/widget-procs.tcl 17 May 2003 10:05:27 -0000 1.19 @@ -55,7 +55,7 @@ # include an extra hidden element to indicate that the # value is being selected as opposed to entered - set output "" + set output "\n" append output [select element $tag_attributes] } @@ -130,9 +130,9 @@ upvar $element_reference element if { [info exists element(value)] } { - return $element(value) + return "$element(value)[input hidden element $tag_attributes]" } else { - return "" + return [input hidden element $tag_attributes] } } @@ -150,6 +150,29 @@ # This can be used in the form template in a tag. set attributes(id) "$element(form_id):elements:$element(name):$element(value)" } + + # Handle display mode of visible normal form elements, i.e. not hidden, not submit, not button, not clear + if { ![string equal $element(mode) "edit"] && ![string equal $type "hidden"] && \ + ![string equal $type "submit"] && ![string equal $type "button"] && \ + ![string equal $type "clear"] } { + + set output "" + switch $type { + checkbox - radio { + # There's a 'subst' done on the contents here + append output "" + # This is ugly, but it works: Only export the value when we're on a selected option + append output "\[ad_decode \$checked \"checked\" \"\" \"\"\]" + } + default { + if { [info exists element(value)] } { + append output [ad_quotehtml $element(value)] + append output "" + } + } + } + } else { + set output "" @@ -269,7 +284,7 @@ # Create an array for easier testing of selected values template::util::list_to_lookup $values_list values - + if { ![string equal $mode "edit"] } { set selected_list [list] set output {} @@ -300,16 +315,20 @@ append output ">\n" foreach option $options_list { - + set label [lindex $option 0] set value [lindex $option 1] - - append output " \n" } @@ -386,13 +405,8 @@ } set query $element(search_query) - if { [info exists element(search_query_name)] } { - set query_name $element(search_query_name) - } else { - set query_name "get_options" - } - set options [db_list_of_lists $query_name $query] + set options [db_list_of_lists get_options $query] set option_count [llength $options]