Description of the problem:
Hello PsychoPy-community,
I am currently trying to use the Textbox2 component on Pavlovia. However, the Textbox2 component does not allow me to type any text (no letter appears on the screen). Offline, I can type anything and it appears on the screen perfectly fine.
I am aware that this is a new component, so there might still be bugs in it. Hoping to use this component instead of adding code snippets because I will need participants to type sentences with accented letters and I heard it was easier using the TextBox2 component instead of writing code snippets…
I have no idea why but even though the ‘editable’ box was ticked that didn’t seem to translate to your JS code (so when I used console.log(typedText.editable) it returned false).
Manually resetting this at the start of your routine fixed this. (in your ‘typedSentence’ component you will see I have added typedText.editable = true; )
Following this though I also had to make your mouse click used to end the routine a bit more specific to allow the user to click on the textbox and type without immediately ending the routine (so you will see I added a component called ‘endButton’ and made it so that only this is clickable)
Hopefully this should work for what you need now
Becca
PS. the reason I renamed your ‘text’ component was because I tried a few bug fixes before finding the solution - you can check over the commit history of my fork if you are curious.
Oh wow @Becca, that is amazing how you figured that out!
Also, Pavlovia can now automatically (finally!) register keypresses on an azerty keyboard and also letters with accents! What a milestone!
Thank you again (I understand very little of what you actually did and what actually went wrong in generating the JS script, but happy that I asked this question. This gives hope for future studies!)
I just had one more question with regards to the output file that get’s generated after completion of the online study.
When I type a sentence (either on an azerty keyboard or a qwerty keyboard and with letters with accents), it appears on the screen perfectly fine and there are no issues there.
However, the typed sentence does not get registered as output in the .csv file (I hope I am clear enough with this). So in the variable “Typedtext.text” I can’t see what my written response was. Because I don’t know what went wrong in the first place and because of my lack of skills in JS, I don’t know what to do to fix it myself.
Any ideas?
P.s. sorry for posting this question in other threads - will keep questions within one thread in the future.
I am having a similar issue where I would like to run some code on the text that a participant types using the editable textbox. However, it isn’t registering any of the text. I tried using the getDisplayedText() function and I got an error saying that ‘TextBox2’ object has no attribute ‘getDisplayedText’. What command can I use to refer to the text that the participant wrote in the editable textbox?
@hcheckeye this isn’t really the same subject as the thread but finding the text in python should be as simple as calling yourTextboxComponentName.text ; also check your output files for the names of logged variables you can use, or check the documentation.
In case you aren’t aware, if you are hoping to move online, you will have to make sure all your Python code translates well into Javascript; you can use Wakefield Carter’s crib sheet for help with this.
@Becca where exactly do you add typedText.editable = true; ?
I am having the same problem in v2021.1.2; and tried adding myTextbox2Component.editable = true; at the “begin routine” portion of a code component on the JS side; but still can’t type words online.