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.27 -r1.28 --- openacs-4/packages/acs-templating/tcl/element-procs.tcl 14 May 2007 20:30:27 -0000 1.27 +++ openacs-4/packages/acs-templating/tcl/element-procs.tcl 25 Sep 2007 15:22:38 -0000 1.28 @@ -197,47 +197,51 @@ } # 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 "" + if {![info exists fs_attributes(class)]} { + append fs_options " class=\"form-fieldset\"" + } + 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