The Choices element enables a user to select an answer from a list of alternatives displayed to them. For example, you can ask customers to select their zip code, or to select a color for a product that they ordered. Choice questions can also be presented using one of several display types.
A choice list is based on one of the following types:
- Regular choices: These choices are hard coded and are created manually.
- Dynamic choices: The choice list is populated in runtime with the values contained in a specified collection.
This article explains how to design questions with Dynamic choices. For information about creating questions that use Regular choices, click here.
Defining the list of Dynamic choices uses the following workflow:
- Selecting the collection that is used to populate the choice list. Both simple collections and object collections are supported.
- Selecting the field from which the choice list is built (relevant for object collections only).
- Specifying a variable to hold the user's answer.
Here is an example of a Dynamic choice radio button list that is populated by the postal code field of an object collection.
To create a question using a Dynamic choice list:
- From the left side of the Page Editor, select the Choices choice element, and drag the element to the Page map. On the right side of the Page Editor, the Element tab opens.
- In the Label field of the Element tab, enter the text of the question.
- Select the Use Dynamic choices checkbox. The Dynamic choices settings are displayed.
- Click in the Dynamic choices field, and select the required collection.
- If you are working with an object collection, select the relevant field from the Label source dropdown list. (The choices list will be comprised of the values of this field.) For example:
- Click in the Saved selection field, and select the variable that will hold the question's answer.
Note: Only variables whose types match the collection type selected are displayed (e.g., if you have chosen an object collection, only variables based on that object collection are displayed). If no variables are displayed, you may create a new variable that is appropriate.
- In the Display section, use the dropdown menu to select the format in which the choices will be displayed. For examples of available formats, see Choices Display Options.
When selecting certain Display formats for Choices, you can also select whether to proceed to the next page following the user selection. This option will appear as a checkbox beneath the selected Choice display in the mapping area. Select the checkbox if it is appropriate for your workflow.
- Configure validation and security settings. If relevant, select the Required Field checkbox and/or the Do not audit the question's answer checkbox. For more information, refer to Choice Question Design: Basic Workflow.
- The Show/Hide Rule field enables you to show or hide the choice question during runtime if a specified Rule condition is met. (A choice question is always displayed by default.) To add a Show/Hide rule, click on the plus icon and enter the condition to meet using the Rule Editor that appears:
After adding the condition, select Show or Hide from the dropdown menu at the lower right to set the question's display status. To delete a Rule, click on Delete rule at the top right corner of the Rule Editor.
For more details and an example, click here.
- The Question Name field stores the runtime response as a User Input variable in order to make it readily available to other Interaction elements. (For details on using choice selections in variables, see Using Choice Selections in Other Elements.) A unique name is automatically assigned by default, but you can enter a more descriptive name of your own.
- To save your changes, at the lower right corner of the Page Editor, click Update Page (or Create Page).
The Page Editor closes, and the Interaction Map is displayed.