-
Hello! I'm trying to set up a survey where first, participants provide a short list of languages they speak, and then second, they rank that list in order of proficiency. I can pull the relevant responses in the console, but I can't use them in the actual study code because it throws this error: What's the correct syntax for using user input as options in a subsequent question? Here's the relevant code; I've tried all of the commented-out bits as members in the "options" array, to no avail:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi! Here is my understanding of the problem: jsPsych will evaluate all parameter values as soon as the experiment loads, even if those parameters are for trials that occur at the end of the experiment. It assumes that the programmer (you) has set the content of each experimental trial to be the same for every study participant, so the parameters of every trial become permanent as soon as the experiment starts and will not respond to data that the participant produces during the experiment. You can get around this obstacle by setting the parameter values to be functions (dynamic parameters). jsPsych only evaluates functions when it comes time to use their outputs, so if a parameter is equal to a function, jsPsych will evaluate the parameter only just before the trial starts, and will use the function output as the parameter value. Your code works fine on my computer when I change it to this:
|
Beta Was this translation helpful? Give feedback.
-
Thanks for your clear and concise explanation and demonstration! Things are working well for me now. 👍 |
Beta Was this translation helpful? Give feedback.
Hi! Here is my understanding of the problem:
jsPsych will evaluate all parameter values as soon as the experiment loads, even if those parameters are for trials that occur at the end of the experiment. It assumes that the programmer (you) has set the content of each experimental trial to be the same for every study participant, so the parameters of every trial become permanent as soon as the experiment starts and will not respond to data that the participant produces during the experiment.
You can get around this obstacle by setting the parameter values to be functions (dynamic parameters). jsPsych only evaluates functions when it comes time to use their outputs, so if a parameter is equa…