carry forward Q2 answer choices that are randomized with a specific answer choice as the LAST one to Q3 where the same order of answer choices are listed with a DIFFERENT last answer choice | XM Community
Skip to main content
Question

carry forward Q2 answer choices that are randomized with a specific answer choice as the LAST one to Q3 where the same order of answer choices are listed with a DIFFERENT last answer choice


hmacdermott
Level 2 ●●
Forum|alt.badge.img+4

Howdy!

I’m stumped and would appreciate any counsel.

Q2 has 14 answer choices total - the first 13 should be randomized, and 14th one has to be the last one (“some statement A”). 

We need Q3 to have the same 13 answer choices from Q2 in the same order AND the 14th answer choice needs to be  “some statement B” (it’s different from the 14th answer choice in Q2).

Any ideas? Will I need some JS code?

Thanks for reading!

Cheers,

Helen

3 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5911 replies
  • January 31, 2025

@hmacdermott,

Yes, you’ll need some JavaScript. You might be interested in this, which addresses this exact situation.

 


hmacdermott
Level 2 ●●
Forum|alt.badge.img+4
  • Author
  • Level 2 ●●
  • 12 replies
  • January 31, 2025

Hi Tom, thanks for replying.

I found that resource but couldn’t get it to work. I’m sure it’s user error, but I don’t understand what I’m doing wrong.

Also, I need the first 12 of 13 items from Q2 to carry over to Q3. The 13th item for both Q2 and Q3 are different. 

I do appreciate you commenting, however. Thank you again.

 


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5911 replies
  • January 31, 2025
hmacdermott wrote:

Hi Tom, thanks for replying.

I found that resource but couldn’t get it to work. I’m sure it’s user error, but I don’t understand what I’m doing wrong.

Also, I need the first 12 of 13 items from Q2 to carry over to Q3. The 13th item for both Q2 and Q3 are different. 

I do appreciate you commenting, however. Thank you again.

In order to use that function you would first have to get the code.

Normally, the last item would be exclusive and you would use display logic to skip the follow-up question if it is selected. However, if it is not exclusive you would move the new item to bottom of the choices in the carryforward question (that’s what the function does) then use additional JS to hide the last item from the previous question if it is displayed based on its choice id. Something like:

Qualtrics.SurveyEngine.addOnload(function() {
  jQuery("#"+this.questionId+" [choiceid=x14]").closest(".Selection").hide();
});

If you are carrying forward all the choices (i.e., displayed choices), then another alternative is to dynamically change the label of the last choice in the carryforward question. Something like:

Qualtrics.SurveyEngine.addOnload(function() {
  jQuery("#"+this.questionId+" .Selection).last().find(".LabelWrapper>label>span").text("some statement B");
});

 


Leave a Reply