Hi,
I am trying to select the default choice of a drill down Question with two questions. This needs to be done with embedded data which contains the text of the default choice, i.e., the actual text value of the options. The challenge was to get the option’s values of the second drill-down after selecting the first one, I have been able to do this is in the preview survey with the following code
The following is the code:
Qualtrics.SurveyEngine.addOnload(function() {
var selects = jQuery("#"+this.questionId+" select");
var sval = jQuery("#"+ this.questionId + " option:contains('${e://Field/s1}')").val();
selects.eq(0).val(sval).trigger('change');
var cval = jQuery("#"+ this.questionId +" option:contains('${e://Field/c1}')").val();
selects.eq(1).val(cval).trigger('change');
});
The issue during the actual survey is that the first dropdown option is selected while the page is being loaded, however, the second dropdown option cannot be found until the page is loaded. Finding the second dropdown option value is working when page is ready, however setting the second option is not working when filling the survey (working in preview when all code is in Qualtrics.SurveyEngine.addOnload). It sets it successfully while there is a loading icon on screen and unsets it instantly when the page is ready. There are no such errors recorded or information about this on other posts. Would be great if anyone could help out with this problem