How to store/reference answers for select2 formatted questions? | XM Community
Skip to main content

Hi all,
I created a pill-box style question by pasting the following code into a text-entry block:


  multiple select
    ">https://code.jquery.com/jquery-3.4.0.js">
    https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css" rel="stylesheet" />
    ">https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js">



Multiple select example



  
  




The code displays a nice pill-box style question, but I have no idea how to store/reference the answers. Specifically, I want to store the answers to this question so I can use the 'Use Reusable Choices' feature and have the responses to this question define the options for a future question.
What steps do I have to take to store/reference the responses? I understand there's some javascript involved but I'm a complete newbie so instructions would be greatly appreciated!

Question Type: Multiple Choise
Add the text and choice as you normally would.
In the question's JS box:
Qualtrics.SurveyEngine.addOnReady(function()
{
jQuery("#"+this.questionId+" select").select2(
{
maximumSelectionLength:5,
width: '400px',
}
);

In Look and Feel General Header

add the following script, in the html editor:

">https://feedback.miamidade.gov/CP/File.php?F=F_ehWk9tBpwpE6UyF">
https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" />


Leave a Reply