Encounter TypeError for online rating-style slider

Hello all, sorry again for posting but I am having trouble with a TypeError error when I upload my experiment with sliders to Pavlovia. Although I am using the updated version of PsychoPy 2021.1.4 and the experiment works well locally, when it is uploaded online I get this error message:

  • TypeError: this._style.forEach is not a function

core-2021.1.4.js:1923 TypeError: this._style.forEach is not a function
at Slider._sanitizeAttributes (visual-2021.1.4.js:1728)
at new Slider (visual-2021.1.4.js:1546)
at Scheduler._currentTask (lbt_0057.js:218)
at Scheduler._runNextTasks (util-2021.1.4.js:1560)
at Scheduler._runNextTasks (util-2021.1.4.js:1564)
at Scheduler._runNextTasks (util-2021.1.4.js:1564)
at update (util-2021.1.4.js:1514)
window.onerror @ core-2021.1.4.js:1923
log4javascript.min.js:1 FATAL unknown | {}
BrowserConsoleAppender.append @ log4javascript.min.js:1

I read through the two similar discussions about this problem before:
Issues with Radio-style slider in Pavlovia v2021.1.1?
Slider not working Pavlovia - TypeError: this._style.forEach is not a function

But one seemed to be solved by updating to the correct PsychoPy version? Right now, I am using the updated version of PsychoPy 2021.1.4 and have tried changing different parameters in the components and experiment setting (versions) to see if some may work online but I have repeated encounters with the same error.

Additionally, I don’t use the forEach function in my code components but I do have a slider that goes through the condition which changes its position and size and this is done in the coding components to modify the slider component.

Any pointers will be appreciated.
Thank you very much for your time and patience!

It might be that you have something set to Each Repeat which needs to be constant to work online

Hello @wakecarter, thank you for the response. On the slider component, I tried to set all of its parameters to constant but only modify it in the coding component. But is it because it is in a loop that updating the parameters this way won’t work online? I have uploaded my .psyexp experiment here. Thank you again.

lbt_1552.psyexp (19.4 KB)
lbt_cond2.xlsx (35.3 KB)

You have created two sliders with the same name – one as a component and one in code. You need to do one or the other.

Oh, I see! I had thought the code component can just modify the same slider but yes that makes sense. Previously, I had just deleted the builder slider component and just run it with the code but nothing showed up so I thought it was the same slider. So if I choose to keep the just slider code component, I would use the shapes component to make the visual aspect of the slider? Would it be something similar to what you have done with the iSlider routine in your interactive slider demo?

Thank you so much for your time and patience!

Have you tried with the builder component and deleting the code? Varying the overall size of the slider should be find in Builder. You may not need my iSlider version unless you are changing the number of labels. Also, I haven’t yet written a radio version.

Hello, thank you for your response again. Yes, I first tried varying the overall size of just using the slider components in Builder but whenever I have the size on ‘set every repeat’ I get this error:

Traceback (most recent call last):
  File "/Users/GraceW./PsycoPy/LBT_test/lbt_0057_lastrun.py", line 97, in <module>
    flip=False, depth=-2, readOnly=False)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/contrib/lazy_import.py", line 120, in __call__
    return obj(*args, **kwargs)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/visual/slider.py", line 191, in __init__
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/visual/slider.py", line 304, in _createElements
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/visual/slider.py", line 437, in _setTickLocs
    self.tickLocs = self._ratingToPos(self.ticks)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/visual/slider.py", line 404, in _ratingToPos
    if self.horiz:
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/visual/slider.py", line 231, in horiz
    return self.size[0] > self.size[1]
TypeError: 'float' object is not subscriptable
##### Experiment ended. #####

And just further testing it out without variables, even using just numbers in the size of the slider components, setting it to ‘set every repeat’ would give the same TypeError as above. It seemed that PsychoPy would only run if I set the size of the slider components to ‘constant’. So that’s when I tried adding in the code components to change the size and position from there without knowing I created two sliders (oops) but knowing this, I will continue to experiment with other ways.

Thank you for the pointers!