Skip to content

Commit 7b7b947

Browse files
committed
refer/link to the new SurveyJS loop and merge feature
1 parent 104bf57 commit 7b7b947

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

docs/overview/building-surveys.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,9 @@ Instead, it's often preferrable to separate the information that changes across
271271

272272
The following section presents some different options for programmatically defining multiple questions in a survey trial, or multiple survey trials, based on an array of values that should change across questions or trials.
273273

274-
The example below shows how to use the `survey_function` to loop over a set of question-level variables (titles/prompts and names), and dynamically add each question to a single survey page. You could use this same approach to add questions across multiple pages within the same survey trial.
274+
One option is to try the new [SurveyJS loop and merge feature](https://surveyjs.io/form-library/examples/loop-and-merge/vanillajs) (available as of `survey` plugin v3.0.0). This feature allows you to create a predefined number of question loops by linking each question loop to a row in a single- or multi-select matrix. Or, you can use a dynamic matrix or dynamic panel to generate question loops in response to participants' responses (e.g. repeat a set of questions for each choice that they selected in a checkbox question).
275+
276+
Another, more flexible option is to use JavaScript to dynamically generate your survey structure. The example below shows how to use the `survey_function` to loop over a set of question-level variables (titles/prompts and names), and dynamically add each question to a single survey page. You could use this same approach to add questions across multiple pages within the same survey trial.
275277

276278
```javascript
277279
const survey_function = (survey) => {

docs/plugins/survey.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ import '@jspsych/plugin-survey/css/survey.css'
512512
<a target="_blank" rel="noopener noreferrer" href="../../demos/jspsych-survey-demo4.html">Open demo in new tab</a>
513513

514514
??? example "Repeating survey trials with different variables"
515-
The survey plugin is not well-suited for use with the jsPsych timeline variables feature, so an alternative to creating a set of repeating survey trials is to construct them in a loop.
515+
The survey plugin is not well-suited for use with the jsPsych timeline variables feature, so an alternative to creating a set of repeating survey trials is to construct them in a loop. You can also check out the [SurveyJS loop and merge feature](https://surveyjs.io/form-library/examples/loop-and-merge/vanillajs).
516516
When adding any data to a survey trial, you should add it via the `data` parameter at the whole-trial level (not inside the question objects), even if it only relates to one question out of multiple questions/pages contained within the trial.
517517
=== "Code"
518518

0 commit comments

Comments
 (0)