Welcome to the LimeSurvey Community Forum

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

Filter answers based on single-choice answer?

More
9 years 6 months ago #112142 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?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 6 months ago #112151 by tpartner
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.
More
9 years 6 months ago #112152 by Ben_V
Some of those discussions:
approach #1
and
approach #2

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.
More
9 years 6 months ago #112158 by mikeu
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?
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose