wwHtmlHelpers::HtmlListBox

Creates an HTML Listbox. The listbox can be populated from a data source of a cursor, array or collection and by binding an evaluated expression for text and value displays of each list item.s

HtmlListBox(lcName,lcSelectedValue,lcDataSource, lcDataValueField,
            lcDataTextField, lcAttributes, 
            lcInitialText, lcInitialValue)

Return Value

Html string for a listbox

Parameters

lcName
The name/id of the listbox

lcSelectedValue The selected value for the listbox.

On a Postback operation lcSelectedValue is automatically read from Request.Form() if available

You can override this behavior, and always force the value to be used by postfixing with ":FORCED" to the end of the value string (ie: TRANSFORM(lnSelectedPk) + ":FORCED").

lcDataSource
The data source. Can be:

    * Table/Cursor Alias * One or two dimensional array Two dimensional array should be value and text respectively. One dimensional can be either the single value or an object. If an object lcDataValueField and lcDataTextField are applied against the item (ie. Company or Address.Street will resolve to loItem.Company, loItem.Address.Street). * Collection Collection can contain an object. Treated like object with array above.

lcDataValueField
An expression that is used for the Value fields in each list item.

lcDataTextField An expression that is used for the content in each list item. If not specified the same value as lcDataValueField is used.

lcAttributes
Any extra HTML attributes you want to use on the list.

lcInitialText
Determines the first item displayed in the list for something like "--- Please select ---". If specified the value for the first item is an empty string.

lcInitialValue
The value for that first injected item.

Example

<%= HtmlListBox("lstCustomers","","TT_Cust","Trim(Company)",;
                "Company + [(] + Careof + [)]","","--- Select a Company") %>

<!-- Always explicitly assign lnSelectedPk -->
<%= HtmlListBox("lstCustomers",TRANS(lnSelectedPk) + ":FORCED","TT_Cust","Trim(Company)",;
                "Company + [(] + Careof + [)]","","--- Select a Company") %>

See also:

Class wwHtmlHelpers

© West Wind Technologies, 1996-2018 • Updated: 09/06/15
Comment or report problem with topic