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 { {user:search,optional {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.
- Parameters:
- element_reference (required)
- Reference variable to the form element
- tag_attributes (required)
- If the "options" attribute is passed in, a select widget is created, otherwise a search box.
- Returns:
- Form HTML for widget
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- 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 $outputXQL Not present: PostgreSQL, Oracle Generic XQL file: packages/acs-templating/tcl/widget-procs.xql