template::widget::input (public)
template::widget::input type element_reference tag_attributes
Defined in packages/acs-templating/tcl/widget-procs.tcl
General proc used by a wide variety of widgets to output input HTML tags.
- Parameters:
- type - The type of widget (checkbox, radio, text etc)
element_reference - Reference variable to the form element
tag_attributes - HTML attributes to hang on the input tag
- Returns:
- Form HTML for widget
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: upvar $element_reference element array set attributes [::template::widget::merge_tag_attributes element $tag_attributes] if { ( $type eq "checkbox" || $type eq "radio" ) && [info exists element(value)] } { # This can be used in the form template in a <label for="id">...</label> tag. set attributes(id) "$element(form_id):elements:$element(name):$element(value)" } elseif { $type in {"password" "text" "button" "file" }} { set attributes(id) "$element(name)" } # Handle display mode of visible normal form elements, i.e. not hidden, not submit, not button, not clear if { $element(mode) ne "edit" && $type ni { hidden submit button clear checkbox radio } } { set output "" if { [info exists element(value)] } { append output [ns_quotehtml $element(value)] append output [subst {<input type="hidden" name="$element(name)" value="[ns_quotehtml $element(value)]">}] } } else { set output [subst {<input type="$type" name="$element(name)"}] if { $element(mode) ne "edit" && $type ni { hidden submit button clear } } { append output " disabled" } elseif { ![info exists element(optional)] && $type ni { hidden submit button clear } } { append output " required" } if { [info exists element(value)] } { append output [subst { value="[ns_quotehtml $element(value)]"}] } foreach name [array names attributes] { if {$attributes($name) eq {}} { append output " $name" } else { append output [subst { $name="$attributes($name)"}] } } if { [info exists element(maxlength)] } { append output [subst { maxlength="$element(maxlength)"}] } append output " >" } return $outputXQL Not present: PostgreSQL, Oracle Generic XQL file: packages/acs-templating/tcl/widget-procs.xql