In this article
For advanced routing, recoding, redirects, calculations on answers to questions or other programming efforts, you can insert script-nodes that will run JScript or JavaScript-code when executed. When using script nodes, care must be taken to create codes that will run without errors. JScript and JavaScript are interpreted programming languages, which means that the code will only be checked at run-time. You should always perform thorough testing of questionnaires that include script nodes.
Figure 1 - The Script node’s details page
Example:
You can use a script node to for example SetStatus script in the survey immediately after the last question but before the additional pages. The script required in this case would be:
SetStatus('complete');
As the respondents pass the script node their status will then be set to Complete even if they end the interview before reaching the last page.
A link to the Scripting documentation is provided at the top-right of the scripting window. Alternatively, refer to the Forsta Scripting documentation for further details.
Note: For Optimized database surveys, if a survey scripter attempts to set an unknown code on a single, grid or 3D-grid, the value is ignored (not set), and a warning email is sent to the survey owner. The respondent will not see any errors. In a similar fashion, if a scripter attempts to set a value that is longer than the field width, the value is truncated and an warning email is sent to the survey owner. Again, the respondent will not see any errors.