template::data::validate::oneof (public)

 template::data::validate::oneof value_ref message_ref

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

Checks whether the submitted value is contained in the list of values provided via the "-options" parameter of "::template::element::create". If it is set an error is thrown.

value_ref - Reference variable to the submitted value
message_ref - Reference variable for returning an error message
True (1) if valid, false (0) if not
See Also:

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

Source code:

    upvar 2 $message_ref message $value_ref value element element values values

    # Note: Parameter "-options" is a list containing two-element lists
    # in the form { {label value} {label value} {label value} ...}
    if {[info exists element(options)] } {
        if {[lsearch -index 1 $element(options) $value] == -1} {

            set message "[_ acs-templating.Invalid_choice] \"[ns_quotehtml $value]\""
            return 0
    } else {
        error "template::element::validate::oneof: No options specified for  element $element_id in form $form_id"

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