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
(defaults to "0") (optional)
-option_index
(defaults to "1") (optional)
Parameters:
stmt_name
sql
Author:
yon [yon@arsdigita.com]

Partial Call Graph (max 5 caller/called nodes):
%3 packages/acs-admin/www/users/index.tcl packages/acs-admin/ www/users/index.tcl db_html_select_value_options db_html_select_value_options packages/acs-admin/www/users/index.tcl->db_html_select_value_options packages/chat/www/search.tcl packages/chat/ www/search.tcl packages/chat/www/search.tcl->db_html_select_value_options db_list_of_lists db_list_of_lists (public) db_html_select_value_options->db_list_of_lists

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_options
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-tcl/tcl/utilities-procs.xql

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