Pike v8.0 release 1738

Method String.HTML.select()


Method select

string select(string name, array(string)|array(array(string)) choices, void|string selected)

Description

Creates an HTML select list.

Parameter name

The name of the select list. Will be used in the name attribute of the select element.

Parameter choices

May either be an array of strings, where each string is a choice, or an array of pairs. A pair is an array with two strings. The first string is the value of the choice while the second string is the presentation text associated with the value.

Parameter selected

The value that should be selected by default, if any.

Example

select("language", ({ ({ "eng", "English" }), ({ "swe", "Swedish" }), ({ "nor", "Norwegian" }) }), "swe");