Saving response from html question | XM Community
Skip to main content

Hi,
I'm using the html code from the following website to create a range slider: https://codepen.io/Pierre_Hamel/pen/ocJEH
This is the code in question:

">https://demos.jquerymobile.com/1.4.2/css/themes/default/jquery.mobile-1.4.2.min.css">  
">https://demos.jquerymobile.com/1.4.2/js/jquery.js">

">https://demos.jquerymobile.com/1.4.2/js/jquery.mobile-1.4.2.min.js">



  

    
    
    
    
  


  
However, no matter how I try, I cannot save the response from the slider in any way. How can I save the responses from this question?
Any help is appreciated.
Thanks.

Use the addOnPageSubmit() function and setEmbeddedData to save the values to embedded data fields.


Hi Tom,
thanks for responding, but I'm still not getting the values. I've added "addOnPageSubmit()" to the JavaScript of the question, but I'm not sure what to add as an embedded data field and its value?
What am I missing?


Set the value of the embedded data fields to the values of range-1a and range-1b.
Be sure to define your embedded data fields in the survey flow prior to the block that contains your sliders.


I've tried this and other iterations, but I'm still unsuccessful. For what it's worth, I'm posting how my JS and the embedded data look like as screenshots as a hail Mary, but I understand if this may be overkill. Perhaps there is something wrong with the code...
Annotation 2020-04-22 153622.pngAnnotation 2020-04-22 153646.png


The problem is that your addOnPageSubmit() function is empty. It should set the embedded field values. For example:
Qualtrics.SurveyEngine.setEmbeddedData("d1",jQuery("#range-1a").val());


Oh! I see, it works now.
Good man! Thank you so much Tom.
Hope this proves useful to others as well.


Leave a Reply