template::data::validate::widget (private)

 template::data::validate::widget value_ref message_ref

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

Here we perform the widget-specific validation, which does not depend on the datatype itself, but rather on the widget logics.

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

Partial Call Graph (max 5 caller/called nodes):
%3 template::data::validate template::data::validate (public) template::data::validate::widget template::data::validate::widget template::data::validate->template::data::validate::widget _ _ (public) template::data::validate::widget->_

Testcases:
No testcase defined.
Source code:
    upvar 2  $message_ref message  $value_ref value  element element

    if {
        [info exists element(widget)] &&
        $element(widget) in {radio select multiselect}
    } {
        # Make sure widgets that are meant to pick an option from a
        # restricted list of values, actually allow only those values.

        # These widgets MUST specify a list of options. When none is
        # specified, validation will fail.
        set options [expr {[info exists element(options)] ? $element(options) : ""}]

        set valid_p false
        foreach o $options {
            lassign $o option_label option_value
            if {$value eq $option_value} {
                set valid_p true
                break
            }
        }
        if {!$valid_p} {
            set message [_ acs-templating.Invalid_choice]
            return 0
        }
    }

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