I'm selecting choices at a Multiple Choice (multi answer) question using JavaScript based on answers to previous Multiple Choice (multi answer) questions, so part of my js includes:
var fromQ5 = "${q://QID124/SelectedChoicesRecode}";
for (let step = 1; step < 70; step++) {
if(fromQ5.includes(step)) this.setChoiceValueByRecodeValue(step, true);
}
This works well however, if someone has selected, say, choice 56, then the js will also select choices 5 and 6 (as they 56 contains 5 and 6).
I thought I could try and embed the step var within text e.g. step + "," - but there is conflicting advice online how do that.
But also, I'm worried that won't quite solve the problem, as "56," also contains "6,".
JavaScript syntax query
Best answer by grahulp5
First try to split the selectedchoice recode and store it in array. Then for arr[i] set choicevalue true.
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.
