Dear Community,
I've to handle a list with 190 items. This is used in different questions where only specific items are shown.
Of course the task can be done by using the display function. However this is a bit of a Sysophos' task and it is rather error prone.
All questions and solutions I've found in this forum so far still rely on the display logic. In order to avoid using the display logic feature I'd rather would use only some JavaScript and embedded data.
Basically I would set embedded data arrays like on displayed and not selected answer options and selected items.
The idea would be to refer to the embedded in a JavaScript function which shows only the required list items.
Has anybody an idea how this can be accomplished?
Thanks for your support
Rudi
Page 1 / 1
Have you considered using Carry Forward instead? You can use display logic and/or Advanced Randomization on just a few questions then Carry Forward the choices to other questions.
Hi Tom,
thanks for your fast reply.
yes I have tried this out.
However the task is a bit different.
Q1: shows all items
Q2: shows all items displayed in Q1 but not selected in Q1
Q3 : shows all items selected in Q1 and max 3 items selected in Q2
Hence, the idea was to have a function which creates the set of items to be shown in Q3 by script, else I would need to create at least 180 embedded data variables which then have to be added to the display logic for each answer stub.
I hope this makes it a bit clearer,
Best regards
Rudi
thanks for your fast reply.
yes I have tried this out.
However the task is a bit different.
Q1: shows all items
Q2: shows all items displayed in Q1 but not selected in Q1
Q3 : shows all items selected in Q1 and max 3 items selected in Q2
Hence, the idea was to have a function which creates the set of items to be shown in Q3 by script, else I would need to create at least 180 embedded data variables which then have to be added to the display logic for each answer stub.
I hope this makes it a bit clearer,
Best regards
Rudi
> @Rudi said:
> However the task is a bit different.
> Q1: shows all items
> Q2: shows all items displayed in Q1 but not selected in Q1
> Q3 : shows all items selected in Q1 and max 3 items selected in Q2
>
> Hence, the idea was to have a function which creates the set of items to be shown in Q3 by script, else I would need to create at least 180 embedded data variables which then have to be added to the display logic for each answer stub.
You wouldn't have to add 180 embedded variables, but you would have to add display logic to 180 choices.
To do this by JavaScript, carry forward all 180 choices from Q1 into Q3, then:
1. Hide all the choices
2. Split the piped selected choices from Q1 into an array
3. Loop through the array and unhide the corresponding choices
4. Split the piped selected choices from Q2 into an array
5. Shuffle the array
6. Splice the array to 3 items
7. Loop through the array and unhide the corresponding choices
> However the task is a bit different.
> Q1: shows all items
> Q2: shows all items displayed in Q1 but not selected in Q1
> Q3 : shows all items selected in Q1 and max 3 items selected in Q2
>
> Hence, the idea was to have a function which creates the set of items to be shown in Q3 by script, else I would need to create at least 180 embedded data variables which then have to be added to the display logic for each answer stub.
You wouldn't have to add 180 embedded variables, but you would have to add display logic to 180 choices.
To do this by JavaScript, carry forward all 180 choices from Q1 into Q3, then:
1. Hide all the choices
2. Split the piped selected choices from Q1 into an array
3. Loop through the array and unhide the corresponding choices
4. Split the piped selected choices from Q2 into an array
5. Shuffle the array
6. Splice the array to 3 items
7. Loop through the array and unhide the corresponding choices
Hi Tom, sorry for thanking you for your detailled answer late. It's very helpful and is exactly what I have been trying. The only remaining question is how do I hide and unhide answer choices in qualtrics. Do we have a function for this?
Best regards
Rudi
Best regards
Rudi
> @Rudi said:
> Hi Tom, sorry for thanking you for your detailled answer late. It's very helpful and is exactly what I have been trying. The only remaining question is how do I hide and unhide answer choices in qualtrics. Do we have a function for this?
> Best regards
>
> Rudi
>
Select the `<li>` element containing the applicable input checkbox and use the jQuery hide() and show() functions.
> Hi Tom, sorry for thanking you for your detailled answer late. It's very helpful and is exactly what I have been trying. The only remaining question is how do I hide and unhide answer choices in qualtrics. Do we have a function for this?
> Best regards
>
> Rudi
>
Select the `<li>` element containing the applicable input checkbox and use the jQuery hide() and show() functions.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.