Free format text input

Hello,

How can I have participants be able to see what they type in real time? For instance, to answer a survey question about their age where they need to input their age in numbers? Without* having the window leave fullscreen mode? I’ve searched extensively on the forum and tried the solutions given there. Nothing worked. Any ideas? Thanks!

You’ll need to explain what you mean. i.e. there have been extensive instructions posted online on how to implement this that have worked for people, so you’ll have to say exactly what problems you encountered when trying them.

Hi Michael,

Thanks for the help. I haven’t found any instructions regarding my specific question in builder, other than in this thread: Unable to give feedback on answers - #15 by elustig The part I tried in that thread was from (see attached). When I tried Oli’s solution, it said keyList is undefined.
Any suggestions appreciated.

Try adding

keyList = []

To the begin experiment tab

Thanks, Oli. That didn’t work, though. Other ideas?

Nope - any more details? Undefined means it the variable hasn’t been declared - if you’ve declared it it should work - can’t guess without more information/screenshots

Oli, thanks. It no longer says undefined - the problem is I can’t see what I type. There are four components in the routine. From top to bottom: code, text1, ageInput, ageExit, text2.
Code contains only this: keyList = [] under Begin Experiment
Text1 says "Type your age (use digits - do NOT spell the number using letters),
then press x."
ageInput stores the keys 1234567890
ageExit ends the routine when x is pressed
text2 is set to a blank duration and set every frame is selected for the update option, and in the text it says $’’.join(keyList)
In other words, text2 is the one I created thanks to your post on another thread.

What I want is the participant to type their age and be able to see on-screen the numbers they are typing (without leaving full-screen).
Instead, what happens is the age is stored and the routine ended with x (so far so good), but no visual feedback occurs.

There should be way more code than that - in the original thread there are full instructions. It looks like you’ve only copied from my last response. Towards the top there is code to check the keyboard, store the keys and allow deletion.

Hi Oli, thanks. Here are all the details:
I’m working within a routine called age (see screenshot).


The routine consists of (top to bottom): code_3, text_16, ageInput, text_19.
Here are the screenshots of the code component:


Screenshot of text16:

Screenshot of ageInput:

Screenshot of text_19

When I run the exp and try to enter an age, press delete a bit, then press return, it quits the whole experiment and says there’s an error in a line of code:

trials.addData(‘age’, ‘’.join(ageInput.keys))
NameError: name ‘trials’ is not defined

Also, the numbers do not appear on screen, and no age info is saved in the outputted data file.

Unlike the previous person you helped, I’m not looking to tell participants about right or wrong answers. I just want them to be able to see and edit the numbers they type on screen (w/o leaving full screen mode)

Ideas?

Thanks!

You haven’t got a loop called trials is why.

Regarding the previous code, all I know is that it worked on my computer and the other users computer. It is not possible for me to debug each case, nor is it useful for yourself. Try getting the code working in a minimal example using the instructions and then add to it.

It is worth noting that Jon has posted a demo of how to get dialogue boxes working with experiments - it might be worth checking that out.

Best wishes,

Oli

Thanks, Oli. Sorry to take so much of your time. As I said earlier, I’m wanting to maintain fullscreen mode - but it appears that dialogue boxes are only available by exiting fullscreen. I’m out of ideas at this point. I’ve asked Jon and hopefully will find out more from there.

I am designing a similar experiment with Psychopy 1.9.3 on Windows 10. I used the prepared script by jacanterbury/ PsychoPy-snippets. It all works perfectly fine.
My problem is that the reaction time of the responses is measured letter by letter instead of being measured a single reaction time for the whole word. The task of the participants is to complete sentences like I entirely … (I entirely agree). The reaction time for agree has the following output:
'[‘a’, ‘g’, ‘r’, ‘e’, ‘e’, ‘return’] [1.8889136424986646, 2.120522313285619, 2.888681803800864, 3.1206617787247524, 3.286471728963079, 3.535615616274299].
Is it possible to change this into a single reaction time somehow?

Thank you for your help in advance.

Hi, you might have already figured it out: In the keyboard component, change “store” from “all keys” to “last key”, thus only the RT for the entire word will be returned while your input text will still be saved in the “inputText” column.