- Posts: 10109
- Thank you received: 3595
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Unchecking excluded checkboxes
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
7 years 4 months ago #146301
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 Unchecking excluded checkboxes
Hmm...I just tested in 2.5.7 and don't seem to need those trigger events to fire Expression Manager
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13648
- Thank you received: 2491
7 years 4 months ago #146306
by DenisChenu
And, sometimes this part was lost in HTML. Using a global event don't add an event to each input , and workaround can be more easy.
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Unchecking excluded checkboxes
Yes, because it was inlinedtpartner wrote: Hmm...I just tested in 2.5.7 and don't seem to need those trigger events to fire Expression Manager
Code:
<input type="radio" onclick="checkconditions($(this).val(), $(this).attr('name'), 'radio', 'click') />
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- andre_twang
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
7 years 3 months ago #146649
by andre_twang
Replied by andre_twang on topic Unchecking excluded checkboxes
Hi Tony,
Your scripts have been extremely helpful! Could I ask what about unchecking excluded checkboxes for "Multiple Choice with Comments" question type, please? This script seems to work for "Multiple Choices" but not for the "Multiple Choices with Comments"
Warm regards,
Andre
Your scripts have been extremely helpful! Could I ask what about unchecking excluded checkboxes for "Multiple Choice with Comments" question type, please? This script seems to work for "Multiple Choices" but not for the "Multiple Choices with Comments"
Warm regards,
Andre
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
7 years 3 months ago #146681
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 Unchecking excluded checkboxes
Here is an updated version if the script that should handle both types of multiple-choice.
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question var thisQuestion = $('#question{QID}'); // Add some classes $('.question-item:not(:last)', thisQuestion).addClass('non-exclusive-item'); $('.question-item:last', thisQuestion).addClass('exclusive-item'); // Handle exclusive items $('input.checkbox', thisQuestion).on('change', function(e) { if($(this).is(':checked')) { var actionItems = $('.non-exclusive-item', thisQuestion); if($(this).closest('.question-item').hasClass('non-exclusive-item')) { actionItems = $('.exclusive-item', thisQuestion); } actionItems.each(function(i) { $('input.checkbox', this).prop('checked', false).trigger('change'); $('input:hidden', this).attr('value', ''); $('input[type="text"]', this).val('').trigger('keyup'); }); } }); }); </script>
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: andre_twang
The topic has been locked.
- andre_twang
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
7 years 3 months ago #146705
by andre_twang
Replied by andre_twang on topic Unchecking excluded checkboxes
Thanks Tony! It worked really well!
The topic has been locked.
- tixeon
- Offline
- Senior Member
Less
More
- Posts: 78
- Thank you received: 2
6 years 1 week ago #167341
by tixeon
Replied by tixeon on topic Unchecking excluded checkboxes
I have tried using this script in version 2.6.7-lts Build 171212 and it doesn’t work. Is there an updated code that will?
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12943
- Thank you received: 3979
6 years 1 week ago #167343
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Unchecking excluded checkboxes
Hi, tixeon,
In the first post of this thread you see that it is about the 2.50-2.73 branch.
You work with the older 2.06 branch, which was renamed - to confuse some users - to 2.6.x
So you cannot expect the script to work.
Best regards
Joffm
In the first post of this thread you see that it is about the 2.50-2.73 branch.
You work with the older 2.06 branch, which was renamed - to confuse some users - to 2.6.x
So you cannot expect the script to work.
Best regards
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
6 years 1 week ago #167427
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 Unchecking excluded checkboxes
I just tested and it does work in 2.06 LTS. Can you attach a small sample survey containing only the affected question?I have tried using this script in version 2.6.7-lts Build 171212 and it doesn’t work.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- krosser
- Offline
- Elite Member
Less
More
- Posts: 222
- Thank you received: 10
6 years 1 day ago #167924
by krosser
Just tested these workarounds and, unfortunately, they do not work anymore in LS 3.7.
I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
Replied by krosser on topic Unchecking excluded checkboxes
tpartner wrote: Try this:
Code:<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question var thisQuestion = $('#question{QID}'); // Uncheck all excluded items $('div.question-item:last input.checkbox', thisQuestion).on('change', function(e) { if($(this).is(':checked')) { $('input.checkbox', thisQuestion).not($(this)).each(function(i) { $(this).prop('checked', false); $(this).nextAll('input:hidden:eq(0)').attr('value', ''); }); $('input[type="text"]', thisQuestion).val(''); } }); }); </script>
Just tested these workarounds and, unfortunately, they do not work anymore in LS 3.7.
I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
6 years 1 day ago - 6 years 1 day ago #167932
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 Unchecking excluded checkboxes
Try changing all instances of 'input.checkbox' to 'input [type="checkbox"]'
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 1 day ago by tpartner.
The topic has been locked.
- krosser
- Offline
- Elite Member
Less
More
- Posts: 222
- Thank you received: 10
6 years 15 hours ago #167950
by krosser
Tried to change it in both lines where it is, but it didn't solve it.
I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
Replied by krosser on topic Unchecking excluded checkboxes
tpartner wrote: Try changing all instances of 'input.checkbox' to 'input [type="checkbox"]'
Tried to change it in both lines where it is, but it didn't solve it.
I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
6 years 11 hours ago #167964
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 Unchecking excluded checkboxes
Sorry, I am away this week with only a phone so can't debug any further.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.