Index: openacs-4/packages/forums/tcl/form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/form-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/forums/tcl/form-procs.tcl 29 Jun 2004 10:18:30 -0000 1.3 +++ openacs-4/packages/forums/tcl/form-procs.tcl 13 Jan 2005 13:58:16 -0000 1.4 @@ -21,43 +21,27 @@ ############################## # Form definition # + + if { $optional_p } { + set optional_switch "-optional" + } else { + set optional_switch "" + } + template::element create $form_name ${prefix}subject \ -label [_ forums.Subject] \ -datatype text \ -widget text \ - -html {size 60} + -html {size 60} \ + $optional_switch template::element create $form_name ${prefix}message_body \ -label [_ forums.Body] \ -datatype richtext \ -widget richtext \ -html {rows 20 cols 60 wrap soft} \ + $optional_switch - - ############################## - # Form validation - # - set subject_val [list] - set content_val [list] - - if {$optional_p} { - template::element set_properties $form_name ${prefix}subject -optional - template::element set_properties $form_name ${prefix}message_body -optional - } else { - lappend subject_val \ - {expr ![empty_string_p [string trim $value]]} \ - "[_ forums.lt_Please_enter_a_subjec]" - - lappend content_val empty \ - {expr ![empty_string_p [string trim $value]]} \ - "[_ forums.lt_Please_enter_a_messag]" - } - - template::element set_properties $form_name ${prefix}subject \ - -validate $subject_val - - template::element set_properties $form_name ${prefix}message_body \ - -validate $content_val } ad_proc -public forums::form::post_message {