Index: openacs-4/packages/acs-templating/resources/forms/standard.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/resources/forms/standard.adp,v
diff -u -r1.17.6.13 -r1.17.6.14
--- openacs-4/packages/acs-templating/resources/forms/standard.adp 30 May 2007 17:21:59 -0000 1.17.6.13
+++ openacs-4/packages/acs-templating/resources/forms/standard.adp 6 Jun 2007 18:35:20 -0000 1.17.6.14
@@ -20,9 +20,12 @@
-
+
+
@@ -118,8 +121,11 @@
-
+
+
+
+
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 -r1.25.6.5 -r1.25.6.6
--- openacs-4/packages/acs-templating/tcl/element-procs.tcl 6 Mar 2007 20:31:13 -0000 1.25.6.5
+++ openacs-4/packages/acs-templating/tcl/element-procs.tcl 6 Jun 2007 18:35:20 -0000 1.25.6.6
@@ -197,47 +197,48 @@
}
# If the widget is a checkbox or radio widget, set attributes
- if { [string equal $opts(widget) radio] || \
- [string equal $opts(widget) checkbox] } {
+ if { [string equal $opts(widget) radio] || \
+ [string equal $opts(widget) checkbox] } {
- # set fieldset attributes
- if { ![info exists opts(fieldset)] } {
- set opts(fieldset) [list class $opts(widget)]
- }
+ # If there's no legend text, no point to generate the fieldset
+ if { ![info exists opts(legendtext)] } {
+ if { [info exists opts(legend)] || [info exists opts(fieldset)] } {
+ ns_log Warning "template::element::create (form: $form_id, element: $opts(name)): you set fieldset and/or legend properties but not the legendtext one. You must provide text for the legend tag."
+ }
+ } else {
- array set fs_attributes $opts(fieldset)
- if { ![info exists fs_attributes(class)] } {
- set fs_attributes(class) $opts(widget)
- }
+ # set fieldset attributes
+ if { ![info exists opts(fieldset)] } {
+ set opts(fieldset) {}
+ }
- set fs_options ""
- foreach name [array names fs_attributes] {
- if { [string equal $fs_attributes($name) {}] } {
- append fs_options " $name"
- } else {
- append fs_options " $name=\"$fs_attributes($name)\""
- }
- }
- set opts(fieldset) $fs_options
+ array set fs_attributes $opts(fieldset)
+ set fs_options ""
+ foreach name [array names fs_attributes] {
+ if { [string equal $fs_attributes($name) {}] } {
+ append fs_options " $name"
+ } else {
+ append fs_options " $name=\"$fs_attributes($name)\""
+ }
+ }
+ set opts(fieldset) $fs_options
- # set legend attributes
- if { ![info exists opts(legendtext)] } {
- set opts(legendtext) ""
- }
- if { ![info exists opts(legend)] } {
- set opts(legend) {}
- }
- array set lg_attributes $opts(legend)
- set lg_options ""
- foreach name [array names lg_attributes] {
- if { [string equal $lg_attributes($name) {}] } {
- append lg_options " $name"
- } else {
- append lg_options " $name=\"$lg_attributes($name)\""
- }
- }
- set opts(legend) $lg_options
- }
+ # set legend attributes
+ if { ![info exists opts(legend)] } {
+ set opts(legend) {}
+ }
+ array set lg_attributes $opts(legend)
+ set lg_options ""
+ foreach name [array names lg_attributes] {
+ if { [string equal $lg_attributes($name) {}] } {
+ append lg_options " $name"
+ } else {
+ append lg_options " $name=\"$lg_attributes($name)\""
+ }
+ }
+ set opts(legend) $lg_options
+ }
+ }
# Remember that the element has not been rendered yet
set opts(is_rendered) f
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 -r1.32.6.5 -r1.32.6.6
--- openacs-4/packages/acs-templating/tcl/form-procs.tcl 6 Mar 2007 20:31:13 -0000 1.32.6.5
+++ openacs-4/packages/acs-templating/tcl/form-procs.tcl 6 Jun 2007 18:35:20 -0000 1.32.6.6
@@ -406,6 +406,12 @@
} {
get_reference
+ # legend can't be empty
+ if { ![string equal $section ""] && [string equal $legendtext ""] } {
+ ns_log Warning "template::form::section (form: $id, section: $section): The section legend is empty. You must provide text for the legend otherwise the section fieldset won't be created."
+ return
+ }
+
set properties(section) $section
set properties(sec_legendtext) $legendtext
@@ -579,9 +585,6 @@
# Legend
set fieldset_legend [lindex $fieldset_list 1]
append output ""
-
- } else {
- append output "
"
+ if { [info exists form_properties(fieldset)] } {
+ template::adp_append_string ""
+ }
+ template::adp_append_string ""
}