<@CHOICELIST NAME=inputname TYPE=select|radio OPTIONS=optionsarray [SIZE=size] [MULTIPLE=yes|no] [CLASS=classname] [STYLE=stylename] [onBlur=script] [onClick=script] [onFocus=script] [VALUES=valuesarray] [SELECTED=selectedarray] [SELECTEXTRAS=selectattributes] [OPTIONEXTRAS=optionattributes] [TABLEEXTRAS=tableattributes] [TREXTRAS=trattributes] [TDEXTRAS=tdattributes] [LABELPREFIX=prefix] [LABELSUFFIX=suffix] [COLUMNS=number] [ROWS=number] [ORDER=columns|rows] [ENCODING=encoding]>
<@CHOICELIST> allows you to easily create HTML selection list boxes, pop-up menus/drop-down lists, and radio button clusters using data from variables, database values, and so on.
This meta tag accepts all the attributes of the standard HTML <SELECT> tag and of the <INPUT TYPE=radio> tags. It also accepts additional attributes for specifying the values in the list and the selected item(s). Radio button groups are always formatted as a table, and an additional series of attributes defines how the radio button group table is to be formatted.
The TYPE attribute defines the type of choice list to create. This is one of SELECT or RADIO (which can be abbreviated as S and R). SELECT is the default if nothing is specified.
The following attributes of the <@CHOICELIST> tag function in the same way as the attributes of the HTML <SELECT> tag or <INPUT TYPE=radio> tag:
The OPTIONS attribute specifies an array of option names to appear in the selection list or radio button group. The array may have either a single column (one option name in each row) or a single row (one option name in each column).
The VALUES attribute defines an optional array of option values. If specified, the size of the array must match the one specified in the OPTIONS attribute. Each array element becomes the value for its corresponding element in the OPTIONS array. If this attribute is not specified, the value for each option is the same as its name.
The SELECTED attribute defines a single value or an array of values to be selected in the list. The value(s) must match items appearing in the VALUES attribute, if specified, or the OPTIONS attribute if VALUES is not specified. Items in this array are selected in the displayed selection list or radio button group.
The OPTIONEXTRAS attribute can be used to set additional <OPTION> tag attributes or <INPUT TYPE=radio> tag attributes. The value of this attribute is placed without parsing in the HTML <OPTION> tag or <INPUT TYPE=radio> tag. For example, OPTIONEXTRAS='CLASS="fred"' adds the CLASS="fred" attribute to each <OPTION> tag or <INPUT TYPE=radio> tag.
The following attributes apply only to lists:
The following attributes apply only to radio button groups:
The ENCODING attribute works slightly differently for the <@CHOICELIST> meta tag: the default encoding for this meta tag is NONE; that is, no escaping of special characters is done for the result of the meta tag; however, this tag does do encoding (always) as part of its normal operation; that is, any special characters within the arrays that define the options list are escaped for HTML. For example, if you specified a list of operators in the options list (= [equals];< [less than];> [greater than]), the characters that have special meaning within HTML (the less-than and greater-than characters) would be encoded as < and >, which are special HTML escape sequences. This appears correctly in a Web browser; that is, as "<" and ">".
The following Tango meta tags appear in an application file:
<@ASSIGN NAME=colors VALUE=<@ARRAY VALUE="red;green;blue;yellow;black;white;"> SCOPE=local>
<@ASSIGN NAME=selectedColor VALUE="red" SCOPE=local>
<@CHOICELIST NAME=colors SIZE=1 OPTIONS=@@colors SELECTED=@@selectedColor>
On execution of the Tango application file, the <@CHOICELIST> meta tag evaluates to the following:
<SELECT NAME=colors SIZE=1>
<OPTION SELECTED>red
<OPTION>green
<OPTION>blue
<OPTION>yellow
<OPTION>black
<OPTION>white
</SELECT>
You can create a drop-down list from an existing array; for example, the resultSet of a Tango action:
<@CHOICELIST NAME=myDropDown SIZE=1 OPTIONS=@@resultSet[*,1]>
The following is a radio button example using the same variable arrays:
<@CHOICELIST NAME=colorChoice TYPE="RADIO" VALUES=@@colors SELECTED=@@selectedColor>
On execution of the Tango application file, the <@CHOICELIST> meta tag evaluates to the following:
<TABLE><TR>
<TD><INPUT type="RADIO" name=colorChoice value="red" CHECKED>red </TD></TR>
<TR><TD><INPUT type="RADIO" name=colorChoice value="green">green </TD></TR>
<TR><TD><INPUT type="RADIO" name=colorChoice value="blue">blue</TD> </TR>
<TR><TD><INPUT type="RADIO" name=colorChoice value="yellow">yellow</TD></TR>
<TR><TD><INPUT type="RADIO" name=colorChoice value="black">black</TD></TR>
<TR><TD><INPUT type="RADIO" name=colorChoice value="white">white</TD></TR></TABLE>
The following example shows the use of table-formatting attributes and label attributes for the radio button group.
<@CHOICELIST NAME=colorChoice TYPE="RADIO" VALUES=@@colors SELECTED=@@selectedColor
TABLEEXTRAS="CELLPADDING=2" labelprefix="<FONT FACE=arial SIZE=1>" labelsuffix="</FONT>">
<TABLE CELLPADDING=2>
<TR><TD><INPUT type="RADIO" name=colorChoice value="red" CHECKED><FONT FACE=arial SIZE=1>red</FONT></TD> </TR>
<TR><TD><INPUT type="RADIO" name=colorChoice value="green"><FONT FACE=arial SIZE=1>green</FONT> </TD></TR>
<TR><TD><INPUT type="RADIO" name=colorChoice value="blue"><FONT FACE=arial SIZE=1>blue</FONT>
</TD></TR>
<TR><TD><INPUT type="RADIO" name=colorChoice value="yellow"><FONT FACE=arial SIZE=1>yellow</FONT></TD></TR>
<TR><TD><INPUT type="RADIO" name=colorChoice value="black"><FONT FACE=arial SIZE=1>black</FONT> </TD></TR>
<TR><TD><INPUT type="RADIO" name=colorChoice value="white"><FONT FACE=arial SIZE=1>white</FONT> </TD></TR>
</TABLE>
The following example shows the use of the COLUMNS attribute for formatting the returned radio button table, returning a two-column table:
<@CHOICELIST NAME=colorChoice TYPE="RADIO" VALUES=@@colors SELECTED=@@selectedColor COLUMNS=2>
<TABLE><TR><TD><INPUT type="RADIO" name=colorChoice value="red" CHECKED>red</TD>
<TD><INPUT type="RADIO" name=colorChoice value="yellow">yellow</TD></TR>
<TR><TD><INPUT type="RADIO" name=colorChoice value="green">green</TD>
<TD><INPUT type="RADIO" name=colorChoice value="black">black</TD></TR>
<TR><TD><INPUT type="RADIO" name=colorChoice value="blue">blue</TD>
<TD><INPUT type="RADIO" name=colorChoice value="white">white</TD></TR>
</TABLE>