Welcome to the LimeSurvey Community Forum

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

Disable Certain Answer Choices Based on Previous Answers

  • JBPichelski
  • JBPichelski's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 2 months ago #212147 by JBPichelski
Hi. I'm wondering if it's possible to block people from giving certain answers depending on their answers to preivous questions.

Example
Question 1: Are you allergic to nuts?

  • No
  • Yes
Question 2: What is your favourite food?
If question 1 = No
  • Pizza
  • Apples
  • Chicken
  • Nuts
If question 1 = Yes
  • Pizza
  • Apples
  • Chicken

Right now, the best way I can find to do something like this is to create 2 different questions and send the users to each one depending on their answer to the first question using conditions. I would rather keep all the results for question 2 in one place, so I was wondering if there was any way of disabling certain answers depending on a participant's previous answer.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #212149 by Joffm
To be honest, the solution with two separated questions is the easiest.

And the only item we have to care of is "nuts".
As a list(radio) question doesn't have "subquestion relevance" you have to do this many times explained procedure.

Between the two questions (Q1 and Q2) create a (hidden) question of type "multiple" (Q2m) with the four items
  1. Pizza
  2. Apples
  3. Chicken
  4. Nuts
In the "default answers set "Pizza, Apples and Chicken" to "checked" (they are always displayed)

Then create a (hidden) question of type "equation" with
{Q2m_4=if(Q1!=1,"Y","")}

Now you set the array filter of Q2 to Q2m.

Remember:
The codes of the multiple question and your second question have to be identical.
The two questions can't be displayed on one page.

 

File Attachment:

File Name: limesurvey...1784.lss
File Size:22 KB


Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • JBPichelski
  • JBPichelski's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 2 months ago #212221 by JBPichelski
Thank you for answering. In the end I decided to go just add a warning on the next page if a participant's answers don't match up. Still, really happy to get an answer to this question so I know for the future.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose