I'm asking a "check all that apply" question (Question 1) and want to use items on the list of Selected Choices (e.g., the first item on the list) in a subsequent question (Question 2).
I would think that there are two approaches:
1) use JavaScript in Question 1 to define the embedded fields for use in Question 2; or
2) use a function in the text for Question 2 that refers back to the Selected Choices in Question 1 to get the values.
I'm indifferent as to which approach I use - just one that works.
When I tried approach 1, using the following JavaScript:
Qualtrics.SurveyEngine.addOnPageSubmit(function ()
{
var choicesall = this.getSelectedChoices();
let choicesarray = choicesall.split(",");
Qualtrics.SurveyEngine.setEmbeddedData('origstring', choicesall);
Qualtrics.SurveyEngine.setEmbeddedData('numofchoices', choicesarray.length);
for (i = 0; i < choicesarray.length; i++) {
var selectedchoice = choicesarray[i]
var embfieldname = "choicenumber" + i;
Qualtrics.SurveyEngine.setEmbeddedData(embfieldname, selectedchoice);
}
});
the embedded variables, such as origstring, numofchoices, etc. are blank.
When I try approach 2, I know that I can use a construct like ${q://QID1/ChoiceGroup/SelectedChoices}. I get the full list of selected choices correctly. But is there a modification to the function call that pulls out item i from the list?
Any suggestion would be most appreciated.
Thanks!
Defining embedded fields from Selected Choices of same question using JavaScript
Sign up
Already have an account? Login
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login to the Community
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
