You can demonstrate how the function works by installing and loading the package:
The function HTMLSelect provides a useful way to generate select tags with webMathematica. It takes a list of the different options and the name to be used when the selection is submitted. Its operation is shown below.
A typical browser will show this as a dropdown menu:
When an HTML form is submitted using this select, the variable $$arg1 will be set to the value of the selected option. In this example $arg1 will be set to 1 if "voltage" is selected, 2 if "current" is selected, and 3 if "resistance" is selected, according to the value assignments.
By default, the values for the option tags are chosen automatically as numbers from 1 to the number of options. It is also possible to set these with an argument.
It is also possible to set the initial selection by using the option SelectedOptions. Typically only one option is selected. In this example, the option labeled "b" will be selected.
The browser will show "b" initially selected:
Selecting the initial option by its value instead of its label can be done with the option SelectedValues.
If no values are given, the SelectedValues option can use the numerical values.