Do not record response to specific slider questions | XM Community
Skip to main content
Solved

Do not record response to specific slider questions


Forum|alt.badge.img+2
  • Level 1 ●
  • 7 replies

Hello all, I would like to create a survey where the responses on particular slider questions are either not recorded or default back to the initial value once the survey is submitted. I am trying the following with JS but this still seems to capture the response.

Any help much appreciated (--a JS newbie). Thanks.

 

 

Qualtrics.SurveyEngine.addOnload(function() {

    var sliderQuestionId = "Q1"; //

    var originalValue = 0; //

 

    this.getQuestionContainer().querySelector('.q-slider').addEventListener('input', function() {

        if (this.value !== originalValue) {

            this.value = originalValue;

        }

    });

});

 

Best answer by Seray

I managed to find a solution. Placing it here in case it’s helpful for others too.

 

I have added the slider function into the html for the question (text/graphic question type), rather than the responses’ JS:

 

<div style="text-align: center;">How easy was it for you to be calm in a difficult situation?<br>
&nbsp;</div>

<div style="text-align: center; padding: 20px;">
    <div style="display: flex; align-items: center; justify-content: center;">
        <span style="margin-right: 10px;">🙁 <br>Not at all easy<br></span>
        <input style="margin: 0 10px;" value="0" max="100" min="0" id="interactiveSlider" type="range">
        <span style="margin-left: 10px;">🙂<br>Very easy </span>
    </div>
</div>

 

 

View original

7 replies

Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+44
  • 1549 replies
  • June 4, 2024

@Seray 

I believe if you do not want the respondent to answer it and want a preselected value, just disable that slider via JS and no one will be able to change it.

Qualtrics.SurveyEngine.addOnload(function()
{
	/*Place your JavaScript here to run when the page loads*/
jQuery('.handle').eq(0).css('pointer-events','none')
});

Additionally, you can have a default value like 0 by default choice option.

Hope it helps!


Forum|alt.badge.img+2
  • Author
  • Level 1 ●
  • 7 replies
  • June 4, 2024

Thank you @Deepak for your prompt reply.

I have tried this option out but I am still able to activate the slider and collect response data. My issue is that I would still like participants to be able to activate the slider, just without capturing the data from it.


Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+44
  • 1549 replies
  • June 4, 2024

@Seray 

To achieve this you can enable the Not applicable checkbox and then use below script in javascript.

It will hide the container and make the value 0 on page submit.

Qualtrics.SurveyEngine.addOnload(function()
{
jQuery('#'+this.questionId+' .n-a-container').css('visibility','hidden');
});

Qualtrics.SurveyEngine.addOnPageSubmit(function()
{
jQuery('#'+this.questionId).find('input[type="checkbox"]').prop("checked", true);
});

Hope it helps!


Forum|alt.badge.img+2
  • Author
  • Level 1 ●
  • 7 replies
  • June 5, 2024

Hi @Deepak - thanks for the suggestion and for your patience!
I tried this too but it still seems to be capturing the slider data. I am including my survey builder suggestions in case there is something that I am doing differently.

survey builder selections
data and analysis view

 


Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+44
  • 1549 replies
  • June 5, 2024

But since it's marked as not applicable it won't be analysed in your data analysis.


Forum|alt.badge.img+2
  • Author
  • Level 1 ●
  • 7 replies
  • June 5, 2024

Thanks, my issue is that it’s sensitive data that I do not want to collect in the first place. It would be great to still enable the slider interaction but then clear or replace the data with another option on submission.


Forum|alt.badge.img+2
  • Author
  • Level 1 ●
  • 7 replies
  • Answer
  • June 5, 2024

I managed to find a solution. Placing it here in case it’s helpful for others too.

 

I have added the slider function into the html for the question (text/graphic question type), rather than the responses’ JS:

 

<div style="text-align: center;">How easy was it for you to be calm in a difficult situation?<br>
&nbsp;</div>

<div style="text-align: center; padding: 20px;">
    <div style="display: flex; align-items: center; justify-content: center;">
        <span style="margin-right: 10px;">🙁 <br>Not at all easy<br></span>
        <input style="margin: 0 10px;" value="0" max="100" min="0" id="interactiveSlider" type="range">
        <span style="margin-left: 10px;">🙂<br>Very easy </span>
    </div>
</div>

 

 


Leave a Reply