In this article
All question types allow you to include scripting. Scripting enables you to:
- Create conditions to control the respondent’s path through the survey.
- Create column (3D grids) and question masks to control whether or not a question is to be displayed.
- Filter the lists displayed in questions and the iterations in loops based on previous answers.
- Perform text substitution.
- Perform custom validation of user input.
To use the scripting functionality in a question, on the question details page for that question go to the Script tab. The scripting fields available to you will depend on the question type.
Figure 1 - Example of the Script tab for a multi question
The Script tab has three sub-tabs.
- It opens at the Masking tab and here, depending on the question type, you can add Code masking (go to Code Masking for more information), Scale masking (go to Scale Masking for more information) and Question masking (go to Excluding and Including Questions With Masking for more information).
- The Custom validation tab allows you to enter script code to validate the answers provided by the respondent (go to Validating Answers for more information).
- The JavaScript tab allows you to add client-side JavaScript to questions.
All scripting fields provide syntax highlighting and code completion (go to Syntax Highlighting and Code Completion for more information).
JavaScript
This tab allows you to add client-side JavaScript to questions, and have it executed once the question has been rendered and any features have been initialized. The JavaScript tab is available for Info, Single, Multi, Open, Grid and 3D-Grid questions (not the questions inside a 3D-Grid).