Second text box not allowing typed responses

Hi everyone,

Mac OS: Version 11.3.1 (Big Sur)
PsychoPy version v2021.2.3

I’m very new to Psychopy and the builder tool. On a few of the trials in my experiment, I need participants to type their responses. The first text box works for respondents when I have them run the study, but every textbox after that does not allow for respondents to type, and the instructions also do not show up.

I attempted to add the code component (text_responses.refresh(); as I noticed that worked for other individuals in the past, but I may have set it up wrong as I repeatedly get this error: NameError: name ‘textbox’ is not defined.

I’ve included screenshots of my current routine and the smaller components within the routine.

Please let me know if there’s a way to resolve this problem. Thank you!!

Hi Jelena,

Do you get this error locally or online?

If you run it online doe it refer to “textbox” or “text_Responses”?

Your code looks good to me! so we just need to pinpoint where “textbox” is

Thanks,
Becca

Hi Becca, when I try to run the study locally the error pops up and the study closes right away. I haven’t been able to have luck running it online either. Let me know if that’s clear, or if there’s any other info I can provide.

Thanks,

please may you copy and paste the error exactly. and confirm whether the error message online is the same to the error you obtain locally.

Hi Becca, the study works when I run it online now (which is my biggest concern), but it’s not working when I run it on my laptop.

Here’s the error I get when I try to run the study on my computer:

File “/Users/jelenagajdel/Desktop/experiment_test/test_experiment_lastrun.py”, line 6087, in
textbox.refresh()
NameError: name ‘textbox’ is not defined

Experiment ended.

Let me know if this helps!

Try text_Responses.refresh()

it looks like somewhere you are using “textbox.refresh()” instead of “text_responses.refresh()” (the second one, that I can see from your screenshot, is correct - but chances are the first one is a stray bit of code somewhere that needs removing).

When you get your error message try clicking on where it gives a line (so for you hover over “line 6087”), that will open up your experiment in coder and take you to a line something like this:

Capture

if you scroll up enough it will say something like "prepare to start routine “trial” (but “trial” will instead refer to a routine name in your experiment, so it will mean somewhere in a code component in that routine you refer to “textbox.refresh()” and that needs removing

Hi Becca, I’ve checked all the text code components and they all say “textbox.refresh()” I can run the study on my laptop and it runs through Pavlovia properly as well.

One issue I’ve run into with the text box responses is there are two textboxes for every trial I have. The first one is towards the beginning of the trial where participants must label the object they see first and again at the end of the trial where participants must label another object. While it runs properly for participants when I go to analyze the data only the first text box in each trial saves the typed answer, not the second one.

Is there any way to fix this so I can guarantee the second response gets saved?

I’ve attached a screenshot of a sample trial for context.

Hi jelena,

Sorry, perhaps I should have been clearer here - they should NOT say textbox.refresh() instead “textbox” should be replaced with whatever the name of your textbox is - for example"text_responses.refresh()"

Thanks,
Becca