How to not have 0 selected by default on slider | XM Community
Question

How to not have 0 selected by default on slider

  • 21 July 2019
  • 7 replies
  • 227 views

Userlevel 1
Hello community,

On our surveys, we use sliders, and they are all configured to have no default value or custom start position. Upon initial page load, the handle is at the far left, where zero is, even though technically no value is selected (you can submit and it will correctly complain that you have to pick an answer first). Visually, this looks like zero is selected by default, however, and it also makes it hard for the participant to actually pick zero from the outset.

Ideally, it would be great to have the handle hidden on initial page load, so the impression to the user is more accurate in that it would show no value is selected. It would also provide an much easier experience since the user could pick zero without having to manipulate the slider first.

Hopefully this makes sense. I would think this could be accomplished through JavaScript or CSS...I just am not familiar with the element IDs I would have to manipulate.

Thanks in advance for any insight!

7 replies

Userlevel 7
Badge +27

Hi there, since it uses inline styling to set the left position at 0px, I don't think the slider handle can have its position changed without using an !important override, which would affect the ability of the respondent to move the handle.
Instead, I've tackled the other option in the past where the handle is hidden until the track is interacted with. Check out this comment.

Userlevel 7
Badge +32

If it's a Qualtrics setup then you can use Add Default Choices option under Question behavior. Try this, hope this will help.

But please take run as it should not proceed on 0 selection without touching slider. In that case you can apply custom validation along with that.

Userlevel 4
Badge +13

Alternatively to the above comments, you can add a validation using JS to check if the respondent has either clicked on the cursor or moved it and force/soft prompt it to do the same.

Badge

Hello!
'But please take run as it should not proceed on 0 selection without touching slider. In that case you can apply custom validation along with that'
'Alternatively to the above comments, you can add a validation using JS to check if the respondent has either clicked on the cursor or moved it and force/soft prompt it to do the same'
I have this problem:
I have created a questionnaire with statements and and slider from 0 to 100. I have chosen 'default choices'. The slider automatically starts at 0, because I want to avoid the respondent always having to touch the slider to give an answer or touch it to indicate a 0. However, now it also registers a missing as a 0. So if the participants do not tick anything Qualtrics registers a 0. I would like to know how I can keep the 'default choices' but that not sliding the slider is registered as a missing instead of a 0. I am going to analyze everything in SPSS.
How can i fix this?

Userlevel 4
Badge +13

You can create a variable to punch the value on page submit and check if there's some value present in slider if the user has clicked/moved the slider. If not then set the variable to -1 and then you can filter the value of slider as either 0-100 or -1 if refused.

Userlevel 4
Badge +12

Hi All,
How about we create a followup question that only appear if respondent select "not applicable". In followup question we can ask respondent that "äre you sure you do not want to use slider?". if respondent selects "yes" in this question then you can identify in data whether "0" came because of slider or "not applicable" button.
I know it's a weird way out but i just came in my mind :P

Userlevel 5
Badge +19

Hi Hannah14 ,
You can use the following method to avoid registering a 0 for the slider if the respondent doesn't touch it:

  1. Create Embedded data variables, one for each slider on the page. For example, if you have 3 sliders, create variables named "Slider1", "Slider2", and "Slider3" and set all those variable as "missing".

  2. Add the following JavaScript code to the Qualtrics JS API:

Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/

});

Qualtrics.SurveyEngine.addOnReady(function()
{// Select all elements with the tag "tbody" and store them in the "tbody" variable
let tbody = document.querySelectorAll('tbody');

// Loop through each element in the "tbody" variable
for (let i = 0; i < tbody.length; i++) {
 // Store the current slider in the "slider" variable
 let slider = tbody[i];

 // Define the "changeHandler" function that will be executed when the "mouseup" event is triggered on the slider
 let changeHandler = function() {
  // Set the value of the embedded data with the name "Slider1", "Slider2", etc. to "0", using the current iteration number "i"
  Qualtrics.SurveyEngine.setEmbeddedData('Slider' + (i + 1), "0");


  // Remove the "mouseup" event listener from the slider after it has been triggered
  slider.removeEventListener("mouseup", changeHandler);
 };

 // Add the "mouseup" event listener to the slider and set the "changeHandler" function as the callback
 slider.addEventListener("mouseup", changeHandler);
}


});

Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/

});


And later you can check in SPSS sheet whether Slider1 variable has "0" or "missing" value and based on that you can determine whether Slider was moved or not.
Hope it resolves your query😊!!

Leave a Reply