How do I make question as mandatory based on certain answer of previous question

6 months 1 week ago - 6 months 1 week ago #202417 by murthyma
Hello Team,

I have a survey with 3 questions.

Question 1: It has a slider to choose a value from 0 to 100.

Question 2: It has a dropdown with 3 values (Good, Ok, Bad).

Question 3: This question has to be displayed always, but it should be mandatory if a value in Question 1 is greater than 20, and if the value in Question 2 is Bad.

Could anyone suggest a solution, please?

I know using conditions we can display/show questions based on conditions of previous questions. But here i want to display the question always and set it mandatory based on value of previous questions. So, need to know where do we set this logic and what is the expression or step to set it based on my above questions.

Last edit: 6 months 1 week ago by murthyma.

Please Log in to join the conversation.

LimeSurvey Partners
6 months 1 week ago #202418 by tpartner
Depending on the question type, you can use a question validation equation.

For example, if Q3 is a list-radio, something like this:

(Q1 > 20 AND Q2 == "answerCodeBad" AND !is_empty(Q3)) 
((Q1 <= 20 OR Q2 != "answerCodeBad") AND (!is_empty(Q3) OR is_empty(Q3)))

Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner -

Please Log in to join the conversation.

6 months 1 week ago #202420 by holch
Or you could create 2 different questions, one mandatory, one none mandatory and show/hide them based on the previous questions via relevance equation.

But keep in mind that you would need to join the responses later. So I think Tpartner's solution is the more "elegant" one.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now