Kia ora koutou, hello everyone!
I have an embedded field 'colour_selection' which is populated with answers from a multiple answer questions in the survey flow. I would like to use Javascript to filter out specific answers, and then from the filtered list take a random answer to store back in to an embedded field to pipe in to a following question.
(I would have loved to do this using a loop and merge, but it seems like it's not possible to exclude answers easily).
I have limited Javascript ability, but have managed to get this code to work fine here https://jsfiddle.net/1etL6axn/
However when I try to run this in Qualtrics I'm getting a console error "colourSelection.filter is not a function".
I get an "access denied" error when I try to post code here, so here is a screenshot. And I've attached the qsf.
!
Is this a limitation within Qualtrics? Should I try to find a solution using JQuery instead? Have I missed something unique to Qualtrics to make this work?
Thanks in advance
Dan
Page 1 / 1
Your issue is that colourSelection is a string, not an array. The first line should be:
```
var colourSelection = "${e://Field/colour_selection}".split(", ");
```
```
var colourSelection = "${e://Field/colour_selection}".split(", ");
```
That is exactly what the problem was. Thank you so much for your help Tom.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.