| Reference | Downloads | Github

Bug: customizing slider labels/ticks in js does not update at beginning routine (keeps previous trial spacing for # labels)


Psychopy v2020.2.3, full screen mode on pavlovia

Description of the problem:
I’m customizing the visuals of a radio slider in js, and pulling labels and ticks while looping through a conditions file. This works okay if I have the same number of ticks for each question, but if the number of ticks/labels changes, it does not: while the number of rating selections is correct, the positions of the labels does not seem to update until the following trial.

For example:
If trial0 radio slider has 5 ticks&labels, it appears as expected.
If trial1 radio slider then has 6 ticks&labels, we see 6 rating choices, but the labels appear to be in the locations for 5 ticks, and is warped in that the “additional label” is wrapped back onto another label (see attached images).
If trial2 radio slider then has 6 ticks&labels, we see 6 rating choices & labels as expected.
If trial3 radio slider then has 5 ticks&labels, we see 5 rating choices, but the labels appear to be in the locations for 6 ticks (so the 5 labels aren’t like up with the rating choices & there’s a weird label gap).

However, if trial4 has 2 ticks&labels, we see 2 rating choices & labels as expected, but I’m guessing that’s because they’re at the anchors of radio choices so there isn’t really another way for them to be spaced out.

Attached visuals of the example, & what the conditions file looks like.

This might be for @apitiot since you’ve recently worked with js slider customization?

Hi there, checking in if this this being looked at at all? This is only a small part of a much larger experiment-- so while I could just separate these out so that each slider is in its own routine (with a lot of redundant code), it seems that wouldn’t be the best option as there are already so many routines and I’ve read there can be memory issues for larger experiments.

Hoping to get this online very soon… happy to test more/provide more info if that would help!

Hi, is this issue being looked at? I’d think this would be a fairly common problem for anyone using a slider in a loop to run a survey online, if there is even one question where the number of responses changes. Not having access to Qualtrics, this is the only way for my team to run surveys.

Is there anything I can do to help move this along?

Hi Sawal,

Sorry for the silence; I’ll raise this issue with someone that has more knowledge of the slider component than I do. I do have something else that might be useful for you. The experiment below illustrates how to embed forms inside of PsychoJS. This way you’ve got a free and open source system for surveys at your disposal that rivals Qualtrics in it’s feature set.

See the README for instruction on how to plugin your own questionnaire.

Best, Thomas

Hello @sawal,

Many apologies for the delay! I have just pushed a fix for the issue.

Interestingly, it worked fine when the ticks were set before the labels, but not the other way around (because the label calculations depend on the ticks).

Incidentally, for your particular experiment, you do not need to call


since you are changing the labels and ticks. So you can remove those lines.

Best wishes,