- Posts: 4
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Inhibit sub-question of multi choice based on other sub questions checked
- ctdh
- Topic Author
- Offline
- New Member
Less
More
11 years 1 month ago #91653
by ctdh
Inhibit sub-question of multi choice based on other sub questions checked was created by ctdh
Hi
I have a 'simple' issue I am struggling with...
A multi choice question:
Q1_SQ1 Choice A
Q2_SQ1 Choice B
Q3_SQ1 Choice C
I would like to be able to disable choice C if either A or B are selected
Can I do this in LS 2.00?
Thanks
Charles
I have a 'simple' issue I am struggling with...
A multi choice question:
Q1_SQ1 Choice A
Q2_SQ1 Choice B
Q3_SQ1 Choice C
I would like to be able to disable choice C if either A or B are selected
Can I do this in LS 2.00?
Thanks
Charles
The topic has been locked.
- ctdh
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
11 years 1 month ago #91662
by ctdh
Replied by ctdh on topic Inhibit sub-question of multi choice based on other sub questions checked
ok I have got this far
The problem is that the if statement is always being triggered even when I uncheck #answer537386X22X3129SQ3
Any ideas what I need to do??
Thanks.
Code:
$(document).ready(function() { $('#answer537386X22X3129SQ3').change(function() { if ( $('#answer537386X22X3129SQ3').val() == 'Y' ) { $('input[name="537386X22X3129SQ1"]').attr('disabled', 'disabled'); } }); });
The problem is that the if statement is always being triggered even when I uncheck #answer537386X22X3129SQ3
Any ideas what I need to do??
Thanks.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3691
11 years 1 month ago #91668
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 Inhibit sub-question of multi choice based on other sub questions checked
It seems to me that your code is trying to disable choice "A", not choice "C".
If you want to disable "C" when "A" or "B" are selected:
If you want to disable "C" when "A" or "B" are selected:
Code:
$(document).ready(function() { $('#answer537386X22X3129SQ1, #answer537386X22X3129SQ2').change(function() { if ( $(this).attr('checked') == true) { $('input[name="537386X22X3129SQ3"]').attr('disabled', 'disabled'); } else { $('input[name="537386X22X3129SQ3"]').attr('disabled', ''); } }); });
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.