OS Mac High Sierra PsychoPy version 2021.2.1 (and now 2021.2.2) Standard Standalone? (y/n) y What are you trying to achieve?:
I want participants to estimate the age of someone in a photo by typing a number into an editable textbox (32 trials), and I’d like for the experiment to run online
What did you try to make it work?:
I made an editable textbox component in builder! It is called AgeEst below.
What specifically went wrong when you tried that?:
The experiment runs fine on my computer, but when I pushed it to Pavlovia, I can estimate the age of the first photo, but none of the subsequent photos. The mouse click successfully ends each trial.
And truly baffling, when I press escape when testing online, the cursor comes back, and I can type stuff in for one trial. When I click the mouse, all subsequent trials have no cursor, just a mouse click that ends the trial.
Thank you so much, Becca! That does the trick.
It’s interesting, the first trial still seems to be a little different, but not in a problematic way for my purposes. If I put a placeholder (space or word) in the textbox as a default, the placeholder doesn’t show up until the second trial, and then it stays for all subsequent trials. (I just deleted the placeholder space, and everything looks just right.)
Thanks again for your help!
Best,
Molly
Interesting observation - we can check that out, thanks for reporting it (i’ve linked this post in the github report) - textbox is still relatively new online so we’re still debugging it! Thanks for helping us do it!
I’m encountering what seems like the same issue, but the textbox.refresh() solution doesn’t seem to work for me.
The issue seems identical: my editable textbox accepts input only on the first trial. On subsequent trials I can’t type anything, unless I press escape, or F11 to toggle fullscreen, or F12 to bring up the console (I’m working in Chrome, by the way). All those actions bring the cursor back and allow me to type again, but only for that trial. On the next trial, the cursor is gone again and I have to bring it back again the same way.
As suggested, I added a textbox.refresh(); line in JS in the “begin routine” tab. This doesn’t solve the problem for me. I also tried changing the place where this code component appears in the Builder order, which changes where the .refresh() line appears in the compiled JS code (either before textbox.setText() or after), but that makes no difference. I then tried adding the textbox.refresh() command to be executed every frame, but again no luck.
Am I doing something wrong? The .refresh() command should be in JS, correct? (In any case, if I put it in Python and have it auto-translated, it comes out the same.)
Thanks for your response, Becca. I’ve now moved on to using the “old” text input method (e.g. demos / textInput · GitLab) which works well for me (better actually), so I probably won’t continue trying to debug the editable-textbox approach, but in case it helps others, or helps you address this issue in the future:
I tried it with the code component in a number of different places in the routine (including before and after the textbox) and it never worked
Yes, my textbox was called rsp_textbox and so my refresh command was rsp_textbox.refresh()
OK I am pleased you fixed your issue. So that we can continue to debug the issue our side please could you share the version of your experiment where the bug was?
If you fork that, I guess you should be able to revert to one of the versions that had the bug (right? correct me if I’m wrong). E.g. the version called “Fixed bracketed for-loop” has the bug, and after that I started to try to fix the problem. In version “Debugging textbox issue #6” I first implemented the .refresh() fix, and then later versions are variations on that fix.
Let me know if you need anything else.
Edit: should have clarified: the actual experiment is in the builder-doodle{.psyexp, .py, .js, …} files.
Hi there! I am facing the exact same issue, though the solution you presented here is not working for me either. I was wondering if there is another solution?
Hello there! I appeared to have the same issue and the above solution did not work for me either. When I added the code and tried to run the experiment locally, I was told that “AttributeError: ‘TextBox2’ object has no attribute ‘refresh’.” I wonder if there is any update on this question or any thoughts on the issue I encountered?