Feed Array of Texts to Multiple Choice

More
2 years 10 months ago #116274 by labatt
labatt created the topic: Feed Array of Texts to Multiple Choice
Hi -

We want to collect 30-50 names in an array of texts and feed the entries into a multiple choice list.

For example, if the users John Smith, Mary Jones and Jimmy Johnson are entered into the first question (Q1), leaving the rest of the possible entries blank, we want those names to appear in a list in Q2, with the option to choose whether they are one or more of a contractor, employee and/or supervisor.

Is there any way to do this?

Q1: Enter names:
1John Smith
2Mary Jones
2Jimmy Johnson

Q2: Please select the appropriate characteristics:
NameEmployeeContractorSupervisor
John SmithCheckboxCheckboxCheckbox
Mary JonesCheckboxCheckboxCheckbox
Jimmy JohnsonCheckboxCheckboxCheckbox

Please Log in to join the conversation.

More
2 years 10 months ago #116275 by holch
holch replied the topic: Feed Array of Texts to Multiple Choice
Feeding them into the multiple choice list should be easy with EM.

Something like {QUESTIONCODE} in the answer options for the multiple choice array should do the trick. The problem is to find out which text boxes have been filled and and then hide the empty options in the multiple choice array. I assume this is possible via Javascript, but I am not expert on this.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
2 years 10 months ago #116295 by tpartner
tpartner replied the topic: Feed Array of Texts to Multiple Choice
You can use array filter on Q2. As the inputs in Q1 are filled in, the corresponding row in Q2 will appear.



Here's a little sample survey.

File Attachment:

File Name: limesurvey...1-16.lss
File Size:22 KB

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The following user(s) said Thank You: holch

Please Log in to join the conversation.

More
2 years 10 months ago #116296 by holch
holch replied the topic: Feed Array of Texts to Multiple Choice
Hey Tony! Happy 2015 (great picture by the way. I am just imagining how you write your Javascript solutions this way... ;-) ).

I did not know that the Array filter works with open ended questions!

Will try that here and add it to my collection of solutions. You never know when you need something like that.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
2 years 10 months ago #116297 by holch
holch replied the topic: Feed Array of Texts to Multiple Choice
Had a look at this and it is not purely Array filter, right?

What does
count(that.q1) > 0

do?

I guess it is hiding the whole question completely until something is filled in. Because if you would use only the array filter, the question would be there, just no answer options, I guess?

But what does this code snipped actually do? It checks if any of the fields have content?

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
2 years 10 months ago #116298 by tpartner
tpartner replied the topic: Feed Array of Texts to Multiple Choice

great picture by the way. I am just imagining how you write your Javascript solutions this way

What you can't see is the beer on the table beside me :laugh:

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!