Piping a list into a drop down from an external web source? | XM Community
Skip to main content

I have a large lists of zip codes, with varying numbers of school districts mapped to each zip code. I have this information saved in an external database. I'm running a survey where I'll already have respondents' zip codes as embedded data, and I wanted to pipe a list of all school districts in their district based on their zip code into a drop down. I've managed to pipe the first school district in each zip code to a searchable drop down menu using javascript and embedded data, but I'm not sure how to pipe an entire list to a dropdown (especially given that each zip code has a different number of school districts).
Does anyone know if this is possible? Thanks in advance!

You can use the select2 ajax option.


Thanks so much! I'm still a little stuck on where/how I would implement that. I have javascript code written out to make the drop down searchable (see below), and then I've also piped in the embedded data as options (${e://Field/dist_name}), but this only works when there's one name per zip code as far as I can tell. Is the select2 ajax something that would go in the addOnReady function? Thanks again!!!
Qualtrics.SurveyEngine.addOnReady(function()
{
var options = {
  placeholder: 'Select an option'
};
jQuery("#"+this.questionId).find('select:first').select2({options});
});


ajax is a select2 option (like placeholder). See the link I sent for an example. You'll need to create a script on your web site that gets the data from the database and outputs it in json format for select2 to use.


Leave a Reply