template::widget::checkbox_text (public)

 template::widget::checkbox_text element_reference tag_attributes

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

Implements the complex widget checkbox_other which combines a checkbox widget with a text widget

Parameters:
element_reference
tag_attributes
Returns:
Error:
Author:
Timo Hentschel <timo@timohentschel.de>
Created:
2004-10-17

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

Testcases:
No testcase defined.
Source code:
    upvar $element_reference element
    if { [info exists element(html)] } {
        array set attributes $element(html)
    }

    array set attributes $tag_attributes

    if { [info exists element(values)] } {
        set checkbox [template::util::checkbox_text::get_property checkbox_value $element(values)]
        set text     [template::util::checkbox_text::get_property text_value $element(values)]
    } else {
        set checkbox {}
        set text {}
    }

    set output {}

    # edit mode
    set checkbox_text [subst {<input type="checkbox" name="$element(name)"}]

    foreach name [array names attributes] {
        if {$attributes($name) eq {}} {
            append checkbox_text " [ns_quotehtml $name]"
        } else {
            append checkbox_text [subst { $name="$attributes($name)"}]
        }
    }

    # Create an array for easier testing of selected values
    template::util::list_to_lookup $checkbox values

    foreach option $element(options) {
        lassign $option label value

        append output  $checkbox_text  [subst { value="[ns_quotehtml $value]"}]
        
        if { [info exists values($value)] } {
            append output { checked="checked"}
        }
        append output ">[ns_quotehtml $label]<br>"
    }
    if {![info exists element(other_label)]} {
        set element(other_label) [_ acs-templating.Other]
    }
    set element(value) $text
    set element(name) $element(name)\.text
    append output  "$element(other_label): "
        [template::widget::input text element $tag_attributes]

    return $output
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-templating/tcl/widget-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: