- Posts: 2
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
How do I make question as mandatory based on certain answer of previous question
- murthyma
- Topic Author
- Offline
- New Member
Less
More
3 years 8 months ago - 3 years 8 months ago #202417
by murthyma
How do I make question as mandatory based on certain answer of previous question was created 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.
Regards,
Murthy
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.
Regards,
Murthy
Last edit: 3 years 8 months ago by murthyma.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
3 years 8 months ago #202418
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 How do I make question as mandatory based on certain answer of previous question
Depending on the question type, you can use a question validation equation.
For example, if Q3 is a list-radio, something like this:
For example, if Q3 is a list-radio, something like this:
Code:
(Q1 > 20 AND Q2 == "answerCodeBad" AND !is_empty(Q3)) OR ((Q1 <= 20 OR Q2 != "answerCodeBad") AND (!is_empty(Q3) OR is_empty(Q3)))
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11758
- Thank you received: 2753
3 years 8 months ago #202420
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 How do I make question as mandatory based on certain answer of previous question
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.
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.
The topic has been locked.