Skip to content

Multiselect#

Multiselects allow users to select multiple options from a list in Imperia templates.

Syntax#

The syntax for creating a MultiSelect element in Imperia templates is as follows:

<select name="IMPERIA:name" size="4" multiple="multiple">
    <option value="value">label</option>
</select>

In this syntax, IMPERIA:name represents the field name for the MultiSelect element. You can replace name with your desired field name. The size attribute determines the number of visible options in the MultiSelect box, and the multiple attribute allows users to select multiple options.

Accessing Selected Values#

The values selected in the MultiSelect element are stored in an array. The array elements are numbered starting from 0. You can reference each array element using bracket syntax, where the bracket contains the position of the desired array instance.

For example, if you have a MultiSelect element named IMPERIA:multiselect with seven options, you can access the value of the second selected option using the following syntax:

<!--XX-multiselect[1]-->

Here, <!--XX-multiselect[1]--> represents the second selected option in the IMPERIA:multiselect MultiSelect element.

Array Blocks#

For further information on working with array elements, including MultiSelect arrays, you can refer to the Array Blocks section of the documentation.

Using MultiSelect elements in your Imperia templates provides a flexible way for users to select multiple options, and the selected values can be easily accessed and utilized in your template logic.