Solved
Using Carry-forward to auto-populate answers in a follow-up question
Hello all,
Is there a way for me to carry forward an answer from a question, into another question and have that answer be logged as the respondent's answer to the second question? My issue is that if the respondent answers X to question #1, then their answer must be X for question #2 but that answer choice is the only one in both questions that has this characteristic. Ideally, if they answer X in the first question then the survey would auto-record that as their answer to the second. Is it possible to do this?
Thanks
Is there a way for me to carry forward an answer from a question, into another question and have that answer be logged as the respondent's answer to the second question? My issue is that if the respondent answers X to question #1, then their answer must be X for question #2 but that answer choice is the only one in both questions that has this characteristic. Ideally, if they answer X in the first question then the survey would auto-record that as their answer to the second. Is it possible to do this?
Thanks
Best answer by TomG
> @aSangasy said:
> Thanks for your response. I'm not really versed in JavaScript but I can learn. Is there any sort of script library in the community that I can use to help me hone in on the correct solution?
>
There isn't a library as part of the community. You can find various code snippets in Developer Corner - Custom Code threads.
Let's say X is choice id 2 in the 1st question, then the choice id in the 2nd question is x2, and the JS would be:
```
Qualtrics.SurveyEngine.addOnload(function() {
var autoChoice = jQuery("#"+this.questionId+" input[choiceid=x2]");
if(autoChoice.length == 1) {
autoChoice.prop("checked", true);
this.clickNextButton();
}
});
```
View original> Thanks for your response. I'm not really versed in JavaScript but I can learn. Is there any sort of script library in the community that I can use to help me hone in on the correct solution?
>
There isn't a library as part of the community. You can find various code snippets in Developer Corner - Custom Code threads.
Let's say X is choice id 2 in the 1st question, then the choice id in the 2nd question is x2, and the JS would be:
```
Qualtrics.SurveyEngine.addOnload(function() {
var autoChoice = jQuery("#"+this.questionId+" input[choiceid=x2]");
if(autoChoice.length == 1) {
autoChoice.prop("checked", true);
this.clickNextButton();
}
});
```
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.