The <select> Tag

Purpose

The <select> tag renders a menu or selection list (i.e., it is mapped to an HTML <select> element).

A <select> tag may expose its group model to page scope. The group model contains information about the selection state. If form data is available, it "knows" how many and which options are to be selected.

The <select> tag may take a list model in its listModel attribute. In this case, the values of contained options are verified to be valid keys in that model.

A <select> tag is used

  1. as a single selection, if the tag correponds to a non-array input or if it corresponds to an array input but specifies an index via its index attribute.
  2. as a multiple selection, if the tag corresponds to an array input and doesn't specify an index.

Requirements

A <select> tag has to be embedded in a <form> tag.

Attributes

Attribute groups: %coreattrs, %i18n and %events.

NameDescription
assertClass Appended to the HTML class attribute, if an assertion concerning this input field failed. (Default: equally named attribute value of the embedding form.)
assertStyle Appended to the HTML style attribute, if an assertion concerning this input field failed. (Default: equally named attribute value of the embedding form.)
disabled Mapped to the HTML attribute of the same name.
errorClass Appended to the HTML class attribute, if the validation of this input field failed. (Default: equally named attribute value of the embedding form.)
errorStyle Appended to the HTML style attribute, if the validation of this input field failed. (Default: equally named attribute value of the embedding form.)
index For array inputs - The array index for this input field.
listModel The select's list model. If given, the value attributes of contained options are verified to to be valid keys in that model.
name Required - Mapped to the HTML attribute of the same name.
onblur Mapped to the HTML attribute of the same name.
onchange Mapped to the HTML attribute of the same name.
onfocus Mapped to the HTML attribute of the same name.
size Mapped to the HTML attribute of the same name.
tabindex Mapped to the HTML attribute of the same name.
varGroupModel If set, the tag exposes its group model to a page scope attribute of that name. The group model contains information about the selection state.

Body

The <select> tag requires a body containing the <option>, <listoption> or <listoptions> tags, which define the entries of the rendered select element.

Related tags

<option>, <listoption>, <listoptions>