Toggle menu

How Options Work

The checkbox group, drop-down, list box and radio group fields store their options as arrays of arrays.

Array Elements

Each option in a list-type field is an array. The array contains two or three elements: the value, the display, and the group.

The value is what will be stored/saved when the form is submitted.

The display is the text that appears in the list, or next to the checkbox.

Group is used by drop-downs and list boxes to organise the options. If you don't have any groups, the options will be in a single list.

Arrays of Arrays

Because each option is an array, all of the options together are held in an array of arrays.

Example

For example, the options in the drop-down field:

List Options - Counties
 

Become:

COUNTY_OPTIONDATA = [
    ["", "Select County...", ""],
    ["Cornwall", "Cornwall", ""],
    ["Devon", "Devon", ""],
    ["Somerset", "Somerset", ""]
]

Note how the first array doesn't have a value. This prevents the text "Select County" being picked as an option.

Querying the Value

When you query the value of a list-type field using .queryFieldValue or the 

Query Field Value
  block, it's the value you'll get back, not the display element. Be careful of this if you are displaying the value back to the user in another field or display template.

Last modified on April 08, 2024

Share this page

Facebook icon Twitter icon email icon

Print

print icon