psychopy.org | Reference | Downloads | Github

TypeError: event is undefined

URL of experiment: https://gitlab.pavlovia.org/obemar/masterarbeit

Description of the problem:

Hi everyone,
When piloting my experiment online, I get the TypeError: event is undefined message. It appears after I press space on the welcome screen to get to the next trial/routine (4 sociodemographic questions, setting every repeat).

Could anyone tell me how to solve this? I have no plan how to handle this. Searching the forum wasn’t helpfull.
Maria

1 Like

@obemar, looks like an auto-translate issue with your custom keyboard code, where the translator has not quite converted your calls to the event module to the valid PsychoJS equivalent. You need to

// Swap
event.clearEvents("keyboard");
// with 
psychoJS.event.clearEvents();

Also, your call to event.getKeys should be:

psychoJS.eventManager.getKeys()

However, it looks like you are using a typed response for your experiment, so I would just adapt the textInput demo code without using auto-translate. See

https://run.pavlovia.org/demos/textinput/html/

1 Like

I see, that solved it, thank you.

I used and adapted the code from the textInput demo but apparently I forgot to change auto-> JS to Both when one time I made changes. I had a look again and put everything right, never would have come to that solution on my own. Thank you again, it works perfectly fine now.

1 Like