Issue in piloting online: TypeError: this._style.forEach is not a function

OS (e.g. Win10): Windows 10
PsychoPy version (e.g. 1.84.x): v.2021.2.3

Hi,
I am trying to pilot my study online with Pavlovia but I got the following error:
TypeError: this._style.forEach is not a function
When opening the google chrome console, it seems the error comes from the Slider.js file on the line 597 but because at this time I am not enough familiar with javascript I am not able to understand what is really going on. To give more details about my study, it aims to be an online survey with slider to rate some pictures. My study works perfectly when run with the builder. The first part of my task works fine online and also contains slider. In the second part of my script (that crashes) I add some code to iteratively change the labels of my sliders, which gives in javascript the following lines:
labels = labs.split(“,”);
slider = new visual.Slider({“win”: psychoJS.window, “name”: “slider”, “startValue”: null, “size”: [0.8, 0.03], “pos”: [0, (- 0.3)], “units”: null, “labels”: labels, “ticks”: [0, 100], “granularity”: 1.0, “style”: “slider”, “styleTweaks”: [], “opacity”: null, “color”: “Black”, “fillColor”: “White”, “borderColor”: “Red”, “colorSpace”: “rgb”, “font”: “Open Sans”, “labelHeight”: 0.03, “flip”: false, “depth”: (- 1), “readOnly”: false});

Finally, I found this issue has been adressed previously but it seems that no solution has been found:

Any idea about what is going on?
Cheers !

Please could you show a screenshot of your slider component.

Are you trying to change the number of labels each routine?

In my interactive slider demo I think I manage to change the labels themselves but not the number.

You also missed this thread which has some technical thoughts.

Thank you so much for sharing these ressources! I will take some time to have a look at this n order to understand if I can solve my error thanks to this.
Indeed I am changing labels each routine but not the number. I am not sure what you exactly need as screenshot, let me know if you were expecting something else.
I also forgot to give you the full error observed in my google chrome console:

TypeError: this._style.forEach is not a function
    at Slider._sanitizeAttributes (Slider.js:597:15)
    at new Slider (Slider.js:239:8)
    at Scheduler2._currentTask (test.js:1269:14)
    at Scheduler2._runNextTasks (Scheduler.js:229:24)
    at async Scheduler2._runNextTasks (Scheduler.js:236:13)
    at async Scheduler2._runNextTasks (Scheduler.js:236:13)
    at async Scheduler2._runNextTasks (Scheduler.js:236:13)
    at async update (Scheduler.js:147:18)
window.onunhandledrejection @ PsychoJS.js:726
log4javascript.js:148 FATAL 18:32:50.826 GUI.dialog psychojs-2021.2.3.js:1257 | {}
BrowserConsoleAppender.append @ log4javascript.js:148
Slider.js:597 Uncaught (in promise) TypeError: this._style.forEach is not a function
    at Slider._sanitizeAttributes (Slider.js:597:15)
    at new Slider (Slider.js:239:8)
    at Scheduler2._currentTask (test.js:1269:14)
    at Scheduler2._runNextTasks (Scheduler.js:229:24)
    at async Scheduler2._runNextTasks (Scheduler.js:236:13)
    at async Scheduler2._runNextTasks (Scheduler.js:236:13)
    at async Scheduler2._runNextTasks (Scheduler.js:236:13)
    at async update (Scheduler.js:147:18)


1 Like

I think the error was mostly due to mistakes in labelling the components in the code component just before my loop. I can not be sure because I had also other errors to manage but to me it seems it was the reason. Next time I will spend more in double checking before opening a request.