Select

Select

{{ select }}

Name Type Description
is_valid Boolean True if one of the defined options is selected. To make a (none) option, define an option with an empty value
value String Delimited string containing the values from all of the selected options. For select fields you do not typically care about this - use selected or values instead
default_value String The default value for this field if no value is specified
options object Contains all of the available options for this select list. Each option is a property on the object where they property key is the option value and the property value is the option text
selected list A list containing the values from all of the selected options
values list A list containing the text from all of the selected options
count Integer The number of selected options
field_id String The identifier for this field
label String The label for this field
output String String containing the text from all of the selected options. May include additional markup in the editor preview to make it easier to edit content

Represents the selection from a select list. The select list may or may not allow multiple selections (defaults to only allow a single selection).

{{ select_field }}

Should be used to display a select list inside a form.

Name Type Description
is_valid Boolean Will always be true
type String Will always be "select"
allow_multiple Boolean Whether or not to allow users to select more than one option from this select list
items object A dictionary containing all of the options and their values to be included in the select list, where the keys are the value to be stored and the values are the text to be displayed
options String The raw and un-parsed options for the select list
delimiter String The string that is used to distinguish one option from another in both the raw options property and the final saved value
value_delimiter String The string that should be used to distinguish the value for each option from the text to be displayed, where the value is to the left of value_delimiter and the text is to the right. Any options that do not contain the value_delimiter will use the full option as both the text and the value
count Integer The number of options in this select list
default_value String The raw and un-parsed default value for this select list. Includes the value of all options that should be selected by default, separated by the delimiter
map_to_attribute String If the user is signed into a profile when they submit this form and map_to_attribute is set, the profile attribute specified in map_to_attribute will be set to the value of this field. This should also be used to override the default value if the user is signed into a profile and the specified attribute has already been set
required Boolean Will be true if the user is required to select an option in this list
required_message String The message to display when the user attempts to submit the form without selecting an option in this list
validators validators The list of validators that should be used to validate this form field, if applicable
element_id String A helper property containing a unique ID for this field on this instance of this form. This value should be different every time the form is output
subtext text Help or hint text to display together with the field
condition condition The condition that should be used to show and hide this form field
classname String CSS class name(s) to be applied to the field
field_id String The identifier for this field
label String The label for this field
output String Default HTML markup for this field, which makes a number of assumptions about other elements on the page that may or may not be included. Developers should avoid using the default output in order to guarantee that forms work as expected, including styling, validation, conditionals, and more. May include additional markup in the editor preview to make it easier to edit content

Examples

Dynamically Include Multiple Templates from a Select List

Copy
{% if page.sidebar_sections.count > 0 %} {% for section in page.sidebar_sections.selected %} {% include section %} {% endfor %} {% endif %}

Dynamically Include Template from a Select List

Copy
{% if page.page_layout.is_valid %} {% endif %}

Dynamically Include Template from a Select List

Copy
{% if page.page_layout.is_valid %} {% endif %}