db_html_select_value_options (public)
db_html_select_value_options [ -bind bind ] \ [ -select_option select_option ] [ -value_index value_index ] \ [ -option_index option_index ] stmt_name sql
Defined in packages/acs-tcl/tcl/utilities-procs.tcl
Generate html option tags with values for an HTML selection widget. If select_option is passed and there exists a value for it in the values list, this option will be marked as selected. The "select_option" can be a list, in which case all options matching a value in the list will be marked as selected.
- Switches:
- -bind (optional)
- -select_option (optional)
- -value_index (optional, defaults to
"0"
)- -option_index (optional, defaults to
"1"
)- Parameters:
- stmt_name (required)
- sql (required)
- Author:
- yon [yon@arsdigita.com]
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set select_options "" if { $bind ne "" } { set options [db_list_of_lists $stmt_name $sql -bind $bind] } else { set options [uplevel [list db_list_of_lists $stmt_name $sql]] } foreach option $options { if { [lindex $option $value_index] in $select_option } { append select_options "<option value=\"[ns_quotehtml [lindex $option $value_index]]\" selected=\"selected\">[lindex $option $option_index]</option>\n" } else { append select_options "<option value=\"[ns_quotehtml [lindex $option $value_index]]\">[lindex $option $option_index]</option>\n" } } return $select_optionsXQL Not present: PostgreSQL, Oracle Generic XQL file: packages/acs-tcl/tcl/utilities-procs.xql