Setting Answer Choices Based on Embedded Data in a Side by Side Question | XM Community
Question

Setting Answer Choices Based on Embedded Data in a Side by Side Question

  • 7 November 2019
  • 0 replies
  • 22 views

Userlevel 2
Badge +10
Hi there,

I'm creating a form for individuals to fill in information about their children. In particular, I ask about their children's first name, birth month, and birth year. For some of the individuals, we already have the children's birth month and birth year. I want to pre-set answer choices in the side by side question (see below) for each child that we know the birth month and birth year. I'm having trouble trying to figure out the exact specifications of the JavaScript I need to pre-set the answer choices. Note that I am using dropdown boxes for month and year.

This is what I would want it to look like, as the participant enters the page, if we knew that Child 1 had a birthday on May, 1995 (note we can have them fill this out for up to 15 children):
!



Here's the code that I've been playing around with (for just one child).

Qualtrics.SurveyEngine.addOnload(function()
{
var C1BM = parseInt('${e://Field/C1BM}');
Qualtrics.SurveyEngine.registry['QID49#1'].setChoiceValue(1, false )
});

Note that I'm _just_ trying to populate the birth month for child one (i.e., C1BM) at the moment as a proof of concept. I'm not sure what to put for the QID exactly and the values within the parentheses of .setChoiceValue. Does anybody have any insight on what I should put for these values?

0 replies

Be the first to reply!

Leave a Reply