[ Previous ] [ Contents ] [ Index ] [ Next ]

ns_htmlselect

Overview

Build an HTML SELECT form widget using specified data

Syntax

ns_htmlselect ?-multi? ?-sort? ?-labels labels? key values ?selecteddata?

Description

ns_htmlselect builds an HTML SELECT tag using the passed-in data. If there are more than 15 values, the SIZE attribute is set to 5.

If -multi is specified, the SELECT will be generated with the MULTIPLE attribute to allow multiple options to be selected.

If -sort is specified, the labels (if specified) or values (if labels are not specified) will be sorted in the option list of the SELECT.

The labels argument is a list of labels that you want to display in place of the values for the SELECT. The order and number of the labels list must match the order and number of the values list.

The key argument specifies the NAME attribute of the SELECT.

The values argument is a list of the OPTIONs for the SELECT. If a labels list is not specified, the values themselves will be used as the option labels.

The selecteddata argument specifies the value (or values, if -multi is specified) that is to be selected by default.

Example

    set foo [ns_htmlselect -sort animal {cat rat mouse} rat]
    

The result of the above command will be:

    <SELECT NAME=animal>
    <OPTION VALUE="cat">cat
    <OPTION VALUE="mouse">mouse
    <OPTION VALUE="rat" SELECTED>rat
    </SELECT>

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1996 America Online, Inc.