Programming Reference Manual
 
Syntax
 
HtmBuildDropDown(ControlName, ListItems[, SelectedValue][, CtlWidth][, ClassName][, Style][, PlaceHolder])
 
Description
The HtmBuildDropDown function creates a standard HTML <select> element with <option> items. Depending on the content of the ListItems parameter, the function supports two modes:
  • SQL Mode: If ListItems begins with an "@" character, the remainder of the string is interpreted as an SQL query. The query is executed, and the returned data is used to populate the dropdown options.
  • Static Mode: Otherwise, ListItems is treated as a semicolon-separated list of options.
The function also highlights the option that matches the optional SelectedValue parameter.
 
Parameter
Description
Controlname
The name (and id) assigned to the <select> element.
ListItems
A string that specifies the dropdown items.
In SQL Mode, the string must start with "@" (e.g., "@SELECT Code, Description FROM Locations").
In Static Mode, the items are separated by semicolons (e.g., "Option1;Option2;Option3").
SelectedValue
Optional. The value that should be pre-selected when the dropdown is rendered.
CtlWidth
Optional. The width of the dropdown element (e.g., "50px" or "40ch"). Defaults to a preset width if not provided.
ClassName 
Optional. A CSS class that will be applied to the <select> element.
Style
Optional. Inline CSS style to be applied to the <select> element.
PlaceHolder
Optional. Text that is displayed as the first (empty) option, guiding the user that a selection is required.
 
 
See Also
Example
' Example using a static list:
HtmBuildDropDown("location", "NY;LA;Chicago;Houston", "LA", "50px", "green-text", "", "<span style='color: #004080; font-weight: bold;'>Choose</span> a location...")
 
' Example using a SQL query:
HtmBuildDropDown("location", "@SELECT Code, Description FROM Locations", "LOC123", "50px", "green-text", "", "<span style='color: #004080; font-weight: bold;'>Select</span> a location...")