Pavlovia -- Checkbox code generates a Type Error Cannot read properties of undefined (reading 'status')

I have created a routine where a participant has to check a box, then press a key to move to the next screen.

I have put the following code :

Begin routine : checkboxes = [polygon] clicked = []

Each Frame for polygon in checkboxes: if mouse.isPressedIn(polygon) and not in clicked: polygon.color = "black" clicked.append(

And added a start condition to the key component : mouse.isPressedIn(polygon)

This works fine locally but when I upload the experiment to Pavlovia I get the following error :

Type Error Cannot read properties of undefined (reading ‘status’)

Would be grateful for help on this issue.

All the best,


It sounds like polygon isn’t defined by the time its status is checked - what’s the line number of the error? If you use the :compile_js: button to view the JavaScript for the experiment, where is the line which looks roughly like this:

var polygon = visual.Polygon(win, 

and is the function it’s in called before the error line / is it called outside a function?

1 Like