Type error with code component on Pavlovia

Description of the problem: I have created a task in which participants indicate on a slider how long they perceive a given duration of time. The trials looks like this:

When creating this task in the builder view, I inserted this code component that successfully changed the size of the slider so that it fit within the slider bar:

This works fine on PsychoPy, however when I uploaded it to Pavlovia I get this error once the trial routine starts:
Screen Shot 2021-02-15 at 4.36.36 PM

I have tried going back in and changing the settings of the code component from “Both” to “JS” to “Auto->JS” and nothing has been successful so far. Do I need to use a different code? Any help with this issue would be greatly appreciated.
Thanks so much!

Hi There,

Looks like marker is not an attribute of slider in psychoJS. JSDoc: Class: Slider

slider._markerSize = [.06, .06]

Would remove the error but might not produce the behaviour you need, so you may want to have a play with other parameters of the object.

Here’s some tips you might find helpful for manipulating component parameters in this way online, and here is a demo of these steps I took with your example markersize.psyexp (6.3 KB) .

You can view the list of attributes a component has online as follows.

  1. Add that component to the window e.g. window.slider = slider
  2. Whilst running your experiment open your developer tools ( sees PsychoPy Python to Javascript crib sheet for how to do this on specific browser)
  3. inside your developer tools console type “window.slider” this will expose all the parameters that object has in psychoJS.

In your example, we can see that “marker” is not in the list (and so is not defined - producing your error), but “_markerSize” is, meaning that this is a parameter we can manipulate online. In the demo builder file, note that code type is set to both (and I also made an edit in the each frame tab).

I hope that this information is helpful!

Hi Becca,
Thank you so much for your response! I added the codes you put in the demo into my experiment but unfortunately instead of changing the size of my slider it simply made the entire bar of the slider red when I clicked on it. Since this was not a critical component of the task, I decided it would be fine to just keep the slider size as is.

However, even once I deleted all of the code components from the Builder mode and re-synced it with Pavlovia, it still shows the same thing (turns the entire bar red when you click on it) and it has also moved my slider labels into the middle rather than on either end of the scale. (Image attached below).

I understand that when adding code components it can become a little tricky with uploading it to PsychoJS, but I assumed that since now everything in my experiment is just Builder components that everything would run smoothly! I am wondering if there is something that is still going wrong in my task or if there is something else I need to fix.

I am very new to PsychoPy and coding in general so preferably I would just like to keep things as simple as possible in order to get it up and running to begin my data collection! Let me know if you have any advice. Thanks again for your help!


Hi Isabel,

Can I please check if you are still having this problem? If you have deleted the code components it sounds like this might be a cache issue - if you clear your browser cache does that revert the slider to it’s previous form as you expected?


Hi Becca,
Yes it is working now, no problem!
Thank you so much again for all your help!