Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Feed Array of Texts to Multiple Choice

  • labatt
  • labatt's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 2 months ago #116274 by labatt
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
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 2 months ago #116275 by holch
Replied by holch on 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 answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 2 months ago #116295 by tpartner
Replied by tpartner on 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.
The following user(s) said Thank You: holch
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 2 months ago #116296 by holch
Replied by holch on 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 answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 2 months ago #116297 by holch
Replied by holch on topic Feed Array of Texts to Multiple Choice
Had a look at this and it is not purely Array filter, right?

What does
Code:
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 answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 2 months ago #116298 by tpartner
Replied by tpartner on 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.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose