Hi,
I have semicolon delimited text in external data reference that i am using to dynamically generate a list of options for my users. This list is customised per user in the contacts directory.
I am using Javascript to generate the options, however the checkboxes are not loading, only the text is loading.
The code I'm using is below. I think its something to do with Stylesheets, can anyone figure out what is wrong?.. Is there a better way to do this?
Qualtrics.SurveyEngine.addOnload(function()
{
// Retrieve the embedded data field
var dynamicChoices = "${e://Field/ExternalDataReference}";
var optionsArray = dynamicChoices.split(';');
var questionId = this.questionId;
var questionContainer = this.getQuestionContainer();
// Find the multiple choice options container
var optionsContainer = this.questionContainer.querySelector('.ChoiceStructure');
// Clear existing options
optionsContainer.innerHTML = '';
// Dynamically create and append new options
for (var i = 0; i < optionsArray.length; i++) {
var option = document.createElement('div');
option.className = 'Choice';
option.innerHTML = '<label><input type="checkbox" name="QID11" value="' + optionsArray[i] + '"> ' + optionsArray[i] + '</label>';
optionsContainer.appendChild(option);
}
});