template::widget::radio_text (public)

 template::widget::radio_text element_reference tag_attributes

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

Implements the complex widget radio_text which combines a radio 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::util::list_to_lookup template::util::list_to_lookup (public) template::util::radio_text::get_property template::util::radio_text::get_property (public) template::widget::input template::widget::input (public) template::widget::radio_text template::widget::radio_text template::widget::radio_text->_ template::widget::radio_text->template::util::list_to_lookup template::widget::radio_text->template::util::radio_text::get_property template::widget::radio_text->template::widget::input

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(value)] } {
        set radio [template::util::radio_text::get_property radio_value $element(value)]
        set text  [template::util::radio_text::get_property text_value $element(value)]
    } else {
        set radio {}
        set text {}
    }
    set output {}

    # edit mode
    set radio_text "<input type='radio' name='$element(name)'"

    foreach name [array names attributes] {
        if {$attributes($name) eq {}} {
            append radio_text $name"
        } else {
            append radio_text $name=\"$attributes($name)\""
        }
    }

    # Create an array for easier testing of selected values
    template::util::list_to_lookup $radio values
    set output ""
    foreach option $element(options) {
        lassign $option label value

        append output "$radio_text value=\"$value\""
        if { [info exists values($value)] } {
            append output { checked="checked"}
        }
        if {$element(mode) ne "edit"} {
            append output " disabled"
        }
        append output ">[ns_quotehtml $label]<br>"
    }
    if {![info exists element(other_label)]} {
        set element(other_label) "[_ acs-templating.Other]"
    }
    append output "$element(other_label): "
    set element(value) $text
    set element(name) $element(name)\.text
    append output [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: