Solved
Default Answer Choices Based on Previous Answer
Dear All,
I'm looking for some input on a survey I've been programming. Respondents will complete the survey every 3 months over the course of 2 years and I'm striving to minimize survey burden for questions that ask about use of current medications. The survey is setup as follows:
* Respondents complete a baseline survey via an anonymous link, and after entering an e-mail address, the folks at Qualtrics helped me setup API calls that create a new contact list entry and I'm also using an API call to send out survey invitations and survey reminders via the Qualtrics mailer.
* I was initially advised to save respondent's answers for the medication questions to embedded data fields that are subsequently added to the respondent's contact list entry via API/web services in the survey flow portion of the survey. In turn, I piped the embedded data values for the medication questions on a summary screen that is presented for all subsequent follow-up surveys. This approach works in theory, but it gets pretty messy and I'm hoping there's a simpler approach than using the API.
* While the baseline survey is accessed via an anonymous link, the follow-up survey invitations use individual survey links.
* Ideally, I'd love to have the previous answers to the medication questions be the default answer choices for the next follow-up survey. For example, the default choices for the medication questions on the follow-up survey (Time 1) would be the choices made during the baseline survey (Time 0), the choices selected at Time 1 would be the default choices for the medication questions at Time 2, etc.
* Would the following JavaScript be what I'm looking for?
Qualtrics.SurveyEngine.addOnload(function() {
this.setChoiceValueByRecodeValue("${q://QID6/SelectedChoicesRecode}", true);
});
Thanks in advance.
Best answer by TomG
No, ${q://QID6/SelectedChoicesRecode} refers to the selected choice in the current survey, not the previous survey. The default choices will have to come from the contact list as embedded variables. So, for example if you saved the Time 0 Q6 recode in your panel as T0Q6recode, then it would be:
```
Qualtrics.SurveyEngine.addOnload(function() {
this.setChoiceValueByRecodeValue("${e://Field/T0Q6recode}", true);
});
```
View originalLeave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.