Skip to content

Choice Block

The choice block provides the ability to present the participant a number of options to choose from. This can be in the shape of radio buttons or a number of checkboxes. A choice block has to be specified within a response block. The structure of this block is summarised below.

Parameters

options
Required.
List of Strings that specifies the text for the various options. The options must consist of at least one element and can not contain any blank texts.
identifiers

Optional, defaults to increasing numbers [1, 2, 3, ...].
List of Strings that identify the options presented in the choice block. The elements of identifiers have to be unique and can each consist of a maximum of 10 characters. If not specified, identifiers defaults to a list of increasing numbers, of the same length as the options List.

Tip

We recommend you supply this parameter. This parameter can later, during your analysis of results, help identify which choice a result belongs to.

default_selection

Optional, defaults to empty list.
String or list of Strings that specify which options are selected by default. The elements of default_selection must also appear in the identifiers List.

  • When the type RADIO is used, the default_selection can contain maximally one element.
  • When the type BUTTONS is used, the default_selection should not be specified.
type
Optional, defaults to CHECKBOX.
Keyword taking the value of either CHECKBOX, RADIO, or BUTTON and specifying the type of selection of the options.
  • The type CHECKBOX can accept multiple answers and needs to be confirmed using another response, such as a button, or maximal duration.
  • The type RADIO can accept only one answer and needs to be confirmed using another response, such as a button, or maximal duration.
  • The type BUTTON can accept only one answer and will immediately continue the trial, much like combining the RADIO type with a regular button response combined.
layout
Optional, defaults to VERTICAL.
Keyword taking the value of either VERTICAL or HORIZONTAL, specifying in which way the options are aligned.
require_selection

Optional, defaults to true. Boolean that specifies whether at least one selection of the options is required.

When the type BUTTONS is used, require_selection takes no effect. To enforce a selection, leave out a button response and trial max_duration.

Example usage

The code below illustrates how the choice block might be used.

Basic Radiobuttons
    experiment {
        trial {
            response {
                choice {
                    options = ["one", "two", "three"]
                    default_selection = 1 //(1)
                    type = RADIO
                    layout = HORIZONTAL
                }
                button
            }
        }
    }
  1. Since the identifiers have defaulted to [1, 2, 3], the current specification of the default_selection now selects the first option ("one").
Radiobuttons with identifiers
    experiment {
        trial {
            stimulus {
                text = "What do you like about dogs?"
            }
            response {
                choice {
                    options = ["I like that their tails wiggle when they are excited.",
                               "I like how friendly dogs are.",
                               "I like that they get excited when I get home from work."]
                    identifiers = ["tails", "friendly", "home"]
                    default_selection = ["tails", "home"]
                    type = CHECKBOX
                }
                button
            }
        }
    }
Back to top