Create hidden multiple choice question filled by embedded data | XM Community

Create hidden multiple choice question filled by embedded data

  • 21 February 2023
  • 3 replies
  • 151 views

Badge

Hey! I'm attempting to create a multiple choice variable (which I need in order to create a weight scheme) where the response option is filled from embedded data, answered automatically, and then the question hidden from the participant.
In this case, I need to use the region the participant is from in the weight scheme. We already have this information in our list so we don't need to actually ask them. So goal is get the region data into the survey via a multiple choice question without showing it to the participant.
Any help with his one would be great!


3 replies

Userlevel 4
Badge +12

Hey mj_stoker,
You can create embedded data fields in top of survey flow(Refer below image):
image.pngYou can pass these fields in a multi choice question and a simple JS(Refer below image):
image.pngQualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+this.questionId).hide();
  this.clickNextButton();
});

Make sure to make these choices by default selected. Hope it will work for you.
image.png

Userlevel 7
Badge +27

mj_stoker,
Here is an example where the region names from the contact list are in the field Region with the values Region1 and Region2. You can change those and add as many as you need. 1 and 2 are the choice ids of the regions in your MC question. This will work with single select or multi-select MC questions (i.e., supports multiple regions stored as 'Region1, Region2').
Qualtrics.SurveyEngine.addOnload(function() {
jQuery(this.questionContainer).hide();
var ids = {
"Region1": 1,
"Region2": 2
};
var qobj = this;
jQuery.each("${e://Field/Region}".split(", "),function(i,val){ qobj.setChoiceValue(ids[val],true); });
qobj.clickNextButton();
});

Badge

Thanks for suggestions everyone!

Leave a Reply