Auto-populating a question based on a previous question before termination | XM Community
Skip to main content
Solved

Auto-populating a question based on a previous question before termination

  • April 3, 2020
  • 3 replies
  • 21 views

Forum|alt.badge.img+6

I have a Yes/No question and if the respondent selected No, I would like to auto-populate the next question with a None before I terminate. How is this possible in Javascript?

Best answer by TomG

Pipe the answer to the Yes/No question into the JS of your second question. Assuming "None" is the last choice in a multi-select MC:
if("{pipe of selected choice goes here}"=="No") {
jQuery("#"+this.quesitonId+" input[type=checkbox]:last").prop("checked",true);
this.clickNextButton();
}

3 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • April 3, 2020

Is the next question text entry? Is it on the same page or a different page?


Forum|alt.badge.img+6
  • Author
  • Level 2 ●●
  • April 3, 2020

The second question is a list of retailers with a None and it's on a separate page.


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Answer
  • April 4, 2020

Pipe the answer to the Yes/No question into the JS of your second question. Assuming "None" is the last choice in a multi-select MC:
if("{pipe of selected choice goes here}"=="No") {
jQuery("#"+this.quesitonId+" input[type=checkbox]:last").prop("checked",true);
this.clickNextButton();
}