Index: openacs-4/packages/acs-templating/tcl/richtext-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/richtext-procs.tcl,v diff -u -r1.14 -r1.15 --- openacs-4/packages/acs-templating/tcl/richtext-procs.tcl 26 Jan 2004 15:39:46 -0000 1.14 +++ openacs-4/packages/acs-templating/tcl/richtext-procs.tcl 29 Jan 2004 15:37:22 -0000 1.15 @@ -1,5 +1,5 @@ ad_library { - Rich text input widgetand datatype for OpenACS templating system. + Rich text input widget and datatype for OpenACS templating system. @author Lars Pind (lars@pinds.com) @creation-date 2003-01-27 @@ -54,13 +54,12 @@ ad_proc -public template::data::validate::richtext { value_ref message_ref } { - upvar 2 $message_ref message $value_ref value + upvar 2 $message_ref message $value_ref richtext_list - # a richtext is a 2 element list consisting of { contents format } - set contents [lindex $value 0] - set format [lindex $value 1] + set contents [lindex $richtext_list 0] + set format [lindex $richtext_list 1] - if { [lsearch [template::util::richtext::formats] $format] == -1 } { + if { ![empty_string_p $contents] && [lsearch -exact [template::util::richtext::formats] $format] == -1 } { set message "Invalid format, '$format'." return 0 } @@ -85,30 +84,29 @@ set contents [ns_queryget $element_id] set format [ns_queryget $element_id.format] - set richtext_list [list $contents $format] - if { [empty_string_p $contents] } { + # We need to return the empty list in order for form builder to think of it + # as a non-value in case of a required element. return [list] } else { - return [list $richtext_list] + return [list [list $contents $format]] } } ad_proc -public template::util::richtext::set_property { what richtext_list value } { - - Replace a property in a list created by a richtext widget. + Set a property of the richtext datatype. - @param what one of: