Skip to content

jsPsychSurveyHtmlForm (Debugging) #3203

Answered by Shaobin-Jiang
Lena3558 asked this question in Q&A
Discussion options

You must be logged in to vote

Let's see what the problem is. The console indicates that an error main.js:19 Uncaught TypeError: Cannot read properties of undefined (reading 'length'). The code on that line is:

var leftInput = jsPsych.data.get().select('response').values[0]['L' + (index)].length;

Now, as your name property in the html string changes as index increments, so that it is L1 in the first trial, L2 in the second, and L3 in the third. However, in the second trial, you are still using jsPsych.data.get().select('response').values[0], which gets the data from the first trial. Naturally, there is only L1 and not L2, causing the error. So the correct way is modifying lines 19 and 20:

var leftInput = jsPsych.data.get(

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Lena3558
Comment options

@Shaobin-Jiang
Comment options

@Lena3558
Comment options

Answer selected by jodeleeuw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants