- Posts: 16
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Hide answer options depending on chosen answer in the question before
- hse_fhstp
- Topic Author
- Offline
- New Member
Less
More
3 years 5 months ago #207268
by hse_fhstp
Hide answer options depending on chosen answer in the question before was created by hse_fhstp
Hi,
I have searched the manual and forums but not found an answer yet. I want to hide answer options in a multiple choice question where the hidden answer is the answer chosen in a single choice question right before. Err… like this:
SC-Q: What fruit do you like the most?
1. Bananas (x)
2. Apples
3. Peaches
4. Strawberries
MC-Q: What fruits do you also like?
(hide: 1. Bananas)
2. Apples
3. Peaches
4. Strawberries
Whatever answer option is chosen in the first question shall be hidden in the latter question. So if in the first question answer option 1 is chosen (Bananas) only the remaining answer options shall be shown (Apples, Peaches, Strawberries).
Is there a way to do this without JS, i. e. via expression manager?
Thanks for your kind help,
Maximilian
I have searched the manual and forums but not found an answer yet. I want to hide answer options in a multiple choice question where the hidden answer is the answer chosen in a single choice question right before. Err… like this:
SC-Q: What fruit do you like the most?
1. Bananas (x)
2. Apples
3. Peaches
4. Strawberries
MC-Q: What fruits do you also like?
(hide: 1. Bananas)
2. Apples
3. Peaches
4. Strawberries
Whatever answer option is chosen in the first question shall be hidden in the latter question. So if in the first question answer option 1 is chosen (Bananas) only the remaining answer options shall be shown (Apples, Peaches, Strawberries).
Is there a way to do this without JS, i. e. via expression manager?
Thanks for your kind help,
Maximilian
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
3 years 5 months ago #207270
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 Hide answer options depending on chosen answer in the question before
Sub-question relevance -
manual.limesurvey.org/Adding_answers_or_...fic_for_subquestions
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: hse_fhstp
The topic has been locked.
- hse_fhstp
- Topic Author
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 0
3 years 5 months ago #207284
by hse_fhstp
Replied by hse_fhstp on topic Hide answer options depending on chosen answer in the question before
Thanks! I have fiddled around some while now but not yet come up with what I need. This is one of the rare occasions where I use the expression manager and I have only veeeeery basic understandig of programming. Could someone please help with the input for the expression manager? Thank you very much!
G1: What fruit do you like the most?
A1: Bananas (x)
A2: Apples
A3: Peaches
A4: Strawberries
G2: What fruits do you also like?
SQ001: Bananas (to be hidden if A1 in G1 is checked)
SQ002: Apples
SQ003: Peaches
SQ004: Strawberries
My guess for the relevance equation for SQ001 in G2 is something like:
if(G1.A1!)
Many thanks in advance,
Maximilian
G1: What fruit do you like the most?
A1: Bananas (x)
A2: Apples
A3: Peaches
A4: Strawberries
G2: What fruits do you also like?
SQ001: Bananas (to be hidden if A1 in G1 is checked)
SQ002: Apples
SQ003: Peaches
SQ004: Strawberries
My guess for the relevance equation for SQ001 in G2 is something like:
if(G1.A1!)
Many thanks in advance,
Maximilian
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12789
- Thank you received: 3940
3 years 5 months ago #207286
by Joffm
the subquestion relevance is 'Display this item if G1 is not equal to "A1"'
G1.NAOK!="A1"
As you don't use numerical codes, you compare a text. Therefore the double quotes.
If you use numerical codes like 1,2,3,... it is G1.NAOK!=1
And the operator?
manual.limesurvey.org/ExpressionScript_-_Presentation#Operators
NAOK is always advisable.
If G1 is not asked because of a condition, it will not be defined, so neither equal "A1" nor unequal "A1". NAOK avoids this problem.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Hide answer options depending on chosen answer in the question before
No,if(G1.A1!)
the subquestion relevance is 'Display this item if G1 is not equal to "A1"'
G1.NAOK!="A1"
As you don't use numerical codes, you compare a text. Therefore the double quotes.
If you use numerical codes like 1,2,3,... it is G1.NAOK!=1
And the operator?
manual.limesurvey.org/ExpressionScript_-_Presentation#Operators
NAOK is always advisable.
If G1 is not asked because of a condition, it will not be defined, so neither equal "A1" nor unequal "A1". NAOK avoids this problem.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: hse_fhstp
The topic has been locked.
- hse_fhstp
- Topic Author
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 0
3 years 5 months ago #207291
by hse_fhstp
Replied by hse_fhstp on topic Hide answer options depending on chosen answer in the question before
Thanks, now everything works fine
The topic has been locked.