Using Pavlovia Survey Responses in Experiments

Dear all,

I watched the YouTube tutorial “Using Pavlovia Survey Responses in Experiments”. My ultimate goal is to show certain stimuli depending on the gender of participants (i.e., if you selected “female” show “female.png”).

However, as I am rather new to Pavlovia, I tried to start with the procedure as shown in the video. Thus, to display the age of participants. I got the following error code when I tried to run the experiment online " * TypeError: Cannot read properties of undefined (reading ‘_overallSurveyResults’)".

Thus, apparently the “$info_survey._overallSurveyResults[‘block1/age’]” function does not store the results of the survey, or at least not of my age variable.

I am beyond grateful for any advice! Thanks a lot in advance!

Where did you get the code ._overallSurveyResults from?

Try surveyResponse = info_survey.getResponse() and then surveyResponse['block_1/age']

Thanks a lot for your fast reply and help! I got the code from the PsychoPy YouTube tutorial.

I created a new experiment to keep things as simple as possible. Again, I just tried to display what was typed into a simple single line input question.
You can see my example study here: Jule Schilling / test_psychopy · GitLab

I tried to run surveyResponse = survey.getResponse() as a custom code and $surveyResponse['block_1/question2'] for the textbox to display the answer but I got the following error code: * TypeError: Cannot read properties of undefined (reading ‘block_1/question2’).

It seems to me that the answers of the survey are not saved, although the total java script for the study looks fine to me.

Is your textbox set to update every repeat or is it constant? The former is correct.

When I change it to every repeat I get this error code: * TypeError: undefined is not an object (evaluating ‘survey.getResponse’)

What is the name of your survey component?

survey

What tab is surveyResponse = survey.getResponse() in? It needs to run after the survey.

It is in the next tab after the survey.

In the Begin Routine tab?

yes

I’ve just had a look at your Builder file.

1 Like

Thanks a lot!! This has solved the issue