Index: openacs-4/packages/acs-templating/tcl/data-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/data-procs.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/acs-templating/tcl/data-procs.tcl 15 Sep 2002 20:48:59 -0000 1.6 +++ openacs-4/packages/acs-templating/tcl/data-procs.tcl 20 Jan 2003 13:39:59 -0000 1.7 @@ -27,6 +27,38 @@ return $result } +ad_proc -public template::data::validate::boolean { value_ref message_ref } { + Validates boolean data types + @author Roberto Mello +} { + + upvar 2 $message_ref message $value_ref value + + set result "" + set value [string tolower $value] + + switch $value { + 0 - + 1 - + f - + t - + n - + y - + no - + yes - + false - + true { + set result 1 + } + default { + set result 0 + set message "Invalid choice \"$value\"" + } + } + + return $result +} + ad_proc -public template::data::validate::text { value_ref message_ref } { # anything is valid for text