- Posts: 117
- Thank you received: 9
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Setting a hidden radio button based on previous question
- paulfiner
- Topic Author
- Offline
- Premium Member
Less
More
4 years 2 months ago #193937
by paulfiner
Setting a hidden radio button based on previous question was created by paulfiner
I'm trying to populate a radio button (hidSEG) question based on answers to a previous radio button (S4)
I have an equation question with the following code:
{hidSEG=if(S4.NAOK==4 OR S4.NAOK==5 OR S4.NAOK==6 OR S4.NAOK==8,1,2)}
This works in that I see the code 1 or 2 appearing in the equation question but the hidSEG question doesn't change at all.
I've been through several posts from the forum trying to do the same thing but I can't get it to work.
I'm using Limesurvey v2.73.0
I have an equation question with the following code:
{hidSEG=if(S4.NAOK==4 OR S4.NAOK==5 OR S4.NAOK==6 OR S4.NAOK==8,1,2)}
This works in that I see the code 1 or 2 appearing in the equation question but the hidSEG question doesn't change at all.
I've been through several posts from the forum trying to do the same thing but I can't get it to work.
I'm using Limesurvey v2.73.0
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11637
- Thank you received: 2737
4 years 2 months ago #193938
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 Setting a hidden radio button based on previous question
Can you upload a small sample of your survey with just the relevant questions.
But the equation looks wrong to me.
I think you need to do something like {if(S4.NAOK==4 OR 5 OR 6 OR 8, hidSEG=1, hidSEG=2)}
Not tested, not sure it works, but I think the structure must be like this rather different.
Let's see if Tpartner, Joffm or Denis can come up with a working example.
If you send the sample survey, I might play around a bit when I find the time. But I am pretty sure the equation is wrong.
But the equation looks wrong to me.
I think you need to do something like {if(S4.NAOK==4 OR 5 OR 6 OR 8, hidSEG=1, hidSEG=2)}
Not tested, not sure it works, but I think the structure must be like this rather different.
Let's see if Tpartner, Joffm or Denis can come up with a working example.
If you send the sample survey, I might play around a bit when I find the time. But I am pretty sure the equation is wrong.
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.
- paulfiner
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 117
- Thank you received: 9
4 years 2 months ago #193941
by paulfiner
Replied by paulfiner on topic Setting a hidden radio button based on previous question
Thanks Holch for looking at this. I changed the equation around to match your suggestion but it still doesn't work.
Attached is a small sample with the relevant questions.
Attached is a small sample with the relevant questions.
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10098
- Thank you received: 3589
4 years 2 months ago #193948
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 Setting a hidden radio button based on previous question
The expression in your first post is the correct format and does work except that in your equation question it is wrapped in a <p> element so it would be good to remove that.
You must understand that the Expression Manager assignment operator only manipulates questions on page load and submit so you will not see the value of "hidSEG" dynamically change as you change "S4".
See the attached sample survey:
You must understand that the Expression Manager assignment operator only manipulates questions on page load and submit so you will not see the value of "hidSEG" dynamically change as you change "S4".
See the attached sample survey:
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: holch
The topic has been locked.
- paulfiner
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 117
- Thank you received: 9
4 years 2 months ago #193949
by paulfiner
Replied by paulfiner on topic Setting a hidden radio button based on previous question
Hi Tony,
Thanks for looking at this - I didn't realise that the hidSEG wouldn't be dynamically changed.
Cheers,
Paul
Thanks for looking at this - I didn't realise that the hidSEG wouldn't be dynamically changed.
Cheers,
Paul
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11637
- Thank you received: 2737
4 years 2 months ago #193955
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 Setting a hidden radio button based on previous question
Thank you for clarifying, Tony!The expression in your first post is the correct format and does work except that in your equation question it is wrapped in a <p> element so it would be good to remove that.
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.