- Posts: 1
- Thank you received: 0
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
- Topic Author
- Offline
- New Member
Less
More
9 years 3 months ago #116274
by labatt
Feed Array of Texts to Multiple Choice was created 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:
Q2: Please select the appropriate characteristics:
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:
1 | John Smith |
2 | Mary Jones |
2 | Jimmy Johnson |
Q2: Please select the appropriate characteristics:
Name | Employee | Contractor | Supervisor |
John Smith | Checkbox | Checkbox | Checkbox |
Mary Jones | Checkbox | Checkbox | Checkbox |
Jimmy Johnson | Checkbox | Checkbox | Checkbox |
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11637
- Thank you received: 2737
9 years 3 months ago #116275
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
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.
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
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
9 years 3 months ago #116295
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
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.
Here's a little sample survey.
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
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11637
- Thank you received: 2737
9 years 3 months ago #116296
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
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 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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11637
- Thank you received: 2737
9 years 3 months ago #116297
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
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
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?
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
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
9 years 3 months ago #116298
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Feed Array of Texts to Multiple Choice
What you can't see is the beer on the table beside me :laugh:great picture by the way. I am just imagining how you write your Javascript solutions this way
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.