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

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

  • Apr 3, 2020 8:08 PM UTC
  • 3 replies
  • 50 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();
}

View original

3 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Apr 3, 2020 8:20 PM UTC

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


Forum|alt.badge.img+6
  • Author
  • Level 2 ●●
  • Apr 3, 2020 8:58 PM UTC

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
  • Apr 4, 2020 12:37 PM UTC

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();
}