template::widget::search (public)

 template::widget::search element_reference tag_attributes

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

Return a widget consisting of either a search box or a search pull-down list. Here is an example of using the search widget with ad_form:

    ad_form -name test -form {
            {result_datatype integer}
            {label "Email"}
            {help_text "Search for a user by email address"}
            {search_query {
                select email from cc_users where lower(email) like '%'||lower(:value)||'%'
Can be either a select widget initially if options supplied or a search box which on submit changes to a select widget.

element_reference - Reference variable to the form element
tag_attributes - If the "options" attribute is passed in, a select widget is created, otherwise a search box.
Form HTML for widget

Partial Call Graph (max 5 caller/called nodes):
%3 template::widget::input template::widget::input (public) template::widget::select template::widget::select (public) template::widget::search template::widget::search template::widget::search->template::widget::input template::widget::search->template::widget::select

No testcase defined.
Source code:
    upvar $element_reference element

    if { ! [info exists element(options)] } {

        # initial submission or no data (no options): a search box
        set output [input search element $tag_attributes]

    } else {

        # options provided so use a select list
        # include an extra hidden element to indicate that the
        # value is being selected as opposed to entered

        set output ""
        append output  [subst {\n<input type="hidden" name="$element(id):select" value="t">}]  [select element $tag_attributes]

    return $output
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:

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