template::element::options (private)

 template::element::options form_id element_id tag_attributes

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

Prepares a multirow data source for use within a formgroup

Parameters:
form_id - The identifier of the form containing the element.
element_id - The unique identifier of the element within the form.
tag_attributes - A name-value list of additional HTML attributes to include in the INPUT tags for each radio button or checkbox, such as JavaScript handlers or special formatting.

Partial Call Graph (max 5 caller/called nodes):
%3 template::element::get_opts template::element::get_opts (private) template::element::options template::element::options template::element::get_opts->template::element::options template::element::get_reference template::element::get_reference (private) template::element::options->template::element::get_reference template::util::list_to_lookup template::util::list_to_lookup (public) template::element::options->template::util::list_to_lookup

Testcases:
No testcase defined.
Source code:
    get_reference

    if { ! [info exists element(options)] } {
        error "No options specified for element $element_id in form $form_id"
    }

    # Remember that the element has been rendered already
    set element(is_rendered) t

    # render the widget once with a placeholder for value
    set element(value) "\$value"
    lappend tag_attributes "\$checked" ""
    set widget "$element(before_html) [template::widget::$element(widget) element $tag_attributes$element(after_html)"

    set options $element(options)
    if { [info exists element(values)] } {
        template::util::list_to_lookup $element(values) values
    }

    # the data source is named formgroup by convention

    upvar #$level formgroup:rowcount rowcount
    set rowcount [llength $options]

    # Create a widget entry for each checkbox in the group
    for { set i 1 } { $i <= $rowcount } { incr i } {

        upvar #$level formgroup:$i formgroup

        set option [lindex $options $i-1]
        set value [lindex $option 1]

        if { ![info exists values($value)] } {
            set checked ""
        } else {
            set checked "checked=\"checked\""
        }

        set formgroup(label)   [lindex $option 0]
        set formgroup(widget)  [subst $widget]
        set formgroup(rownum)  $i
        set formgroup(checked) $checked
        set formgroup(option)  $value
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: