- Posts: 3
- Thank you received: 1
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Filter answers based on single-choice answer?
- mikeu
- Topic Author
- Offline
- New Member
Less
More
9 years 6 months ago #112142
by mikeu
Filter answers based on single-choice answer? was created by mikeu
I am trying to create a question whose valid/displayed responses depend on the selected answer from a previous drop-down list. Is this possible?
As a very simplified example, suppose I ask Q1 "In which country do you live?" and have a drop-down list with answers Germany and France.
Then I want the next question to be "What is your favourite city in {country}?", and set things up so that if the respondent answered Q1 with Germany, they can answer Q2 from a drop-down list with Berlin, Munich, or Frankfurt, but if they answered Q1 with France, then they can select instead Paris, Nice, or Marseille.
Whatever answers they select, I want to end up with a single value for {country} and one for {city}. The only methods I've found so far would be either to use relevance equations on many secondary questions to come up with e.g. {city_de}, {city_fr}, or possibly to use a multiple choice question for Q1, with a validation rule that makes sure exactly one country is selected. Neither of these options seems great to me.
Is there another method that I've missed so far?
As a very simplified example, suppose I ask Q1 "In which country do you live?" and have a drop-down list with answers Germany and France.
Then I want the next question to be "What is your favourite city in {country}?", and set things up so that if the respondent answered Q1 with Germany, they can answer Q2 from a drop-down list with Berlin, Munich, or Frankfurt, but if they answered Q1 with France, then they can select instead Paris, Nice, or Marseille.
Whatever answers they select, I want to end up with a single value for {country} and one for {city}. The only methods I've found so far would be either to use relevance equations on many secondary questions to come up with e.g. {city_de}, {city_fr}, or possibly to use a multiple choice question for Q1, with a validation rule that makes sure exactly one country is selected. Neither of these options seems great to me.
Is there another method that I've missed so far?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
9 years 6 months ago #112151
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 Filter answers based on single-choice answer?
There have been many discussions in the forum about filtering dropdown answers by previous question(s), and, while it is possible with JavaScript, my thinking is that the simplest route is several secondary questions controlled with relevance.
.
.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- Ben_V
- Offline
- Platinum Member
Less
More
- Posts: 1223
- Thank you received: 351
9 years 6 months ago #112152
by Ben_V
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Replied by Ben_V on topic Filter answers based on single-choice answer?
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.
- mikeu
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 1
9 years 6 months ago #112158
by mikeu
Replied by mikeu on topic Filter answers based on single-choice answer?
Thank you both for your replies. I unfortunately won't have time to work through them for a couple of hours yet, but I wanted to ask a follow up in case it turns out I don't need to.
Does the solution still require these JavaScript work-arounds if the second question is an array of radio buttons instead of a drop-down?
Does the solution still require these JavaScript work-arounds if the second question is an array of radio buttons instead of a drop-down?
The topic has been locked.