template::data::validate::boolean (public)

 template::data::validate::boolean value_ref message_ref

Defined in packages/acs-templating/tcl/data-procs.tcl

Validates boolean data types.

Parameters:
value_ref - Reference variable to the submitted value
message_ref - Reference variable for returning an error message
Returns:
True (1) if valid, false (0) if not
Author:
Roberto Mello

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_boolean validate_boolean (test acs-templating) template::data::validate::boolean template::data::validate::boolean test_validate_boolean->template::data::validate::boolean _ _ (public) template::data::validate::boolean->_

Testcases:
validate_boolean
Source code:

    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 "[_ acs-templating.Invalid_choice] \"[ns_quotehtml $value]\""
        }
    }

    return $result
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: