Skip to content

Form: add options field

Plugin ID: eca_form_add_optionsfield

Available since: 1.0.0

Add a field with options as radios, checkboxes or select dropdown to the current form in scope.

Fields

Allow multiple values — config key: multiple

Whether the user can select more than one value in the option field.

Type: checkbox · Required: no · Default: true

Options — config key: options

Can be a comma-separated sequence of key-value pairs (e.g. k1:v1,k2:v2 or a token that holds a list of key-value pairs. Alternatively use YAML syntax to define one key-value pair per line. Example: key1: "value1". When using tokens and YAML altogether, make sure that tokens are wrapped as a string. Example: title: "[node:title]"
This field supports tokens.

Type: textarea · Required: no · Default: empty string

Interpret above value as YAML format — config key: use_yaml

When using YAML format to define the options above, this option needs to be enabled.

Type: checkbox · Required: no · Default: false

Validate YAML to prevent this from being executed when invalid — config key: validate_yaml

Type: checkbox · Required: no · Default: false

Field type — config key: type

List of the available types of the field to be added.
When using the "Defined by token" option, make sure there is a token with this name: eca_form_add_optionsfield_type

Type: select · Required: yes · Default: select

Allowed values: checkboxes, select, _eca_token

Field name — config key: name

The field name is a machine name and is used for being identified on form submission. Example: first_name. It can later be accessed via token [current_form:values:first_name].
This field supports tokens.

Type: textfield · Required: yes · Default: empty string

Field title — config key: title

The title of the field to be added.
This field supports tokens.

Type: textfield · Required: yes · Default: empty string

Field description — config key: description

The description of the field to be added.
This field supports tokens.

Type: textarea · Required: no · Default: empty string

Field is required — config key: required

Whether the added field is required or not.

Type: checkbox · Required: no · Default: false

Default value — config key: default_value

The default value if the field is empty.
This field supports tokens.

Type: textarea · Required: no · Default: empty string

Element weight — config key: weight

The lower the weight, the submit action appears before other submit actions having a higher weight.

Type: number · Required: yes · Default: 0