- Posts: 136
- Thank you received: 4
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Last Option In Array (Numbers) (Checkboxes) column Excludes All Others
- surveySn
- Topic Author
- Offline
- Premium Member
Less
More
3 years 4 months ago #208762
by surveySn
Last Option In Array (Numbers) (Checkboxes) column Excludes All Others was created by surveySn
Hello everyone,
Last Option In Array (Numbers) (Checkboxes) column Excludes All Others
manual.limesurvey.org/Workarounds:_Manip..._Excludes_All_Others
How do it?
I searched the forum and there was no answer to the column.
Last Option In Array (Numbers) (Checkboxes) column Excludes All Others
manual.limesurvey.org/Workarounds:_Manip..._Excludes_All_Others
How do it?
I searched the forum and there was no answer to the column.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
3 years 4 months ago - 3 years 4 months ago #208764
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 Last Option In Array (Numbers) (Checkboxes) column Excludes All Others
Do not double-post.
- forums.limesurvey.org/forum/can-i-do-thi...-all-others&start=15I searched the forum and there was no answer to the column.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 3 years 4 months ago by tpartner.
The topic has been locked.
- surveySn
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 136
- Thank you received: 4
3 years 4 months ago #208766
by surveySn
Replied by surveySn on topic Last Option In Array (Numbers) (Checkboxes) column Excludes All Others
forums.limesurvey.org/forum/can-i-do-thi...-all-others&start=15
This is row exclusive,
I want to be column exclusive,
could you help me,
Version 3.22.11 + 200330
This is row exclusive,
I want to be column exclusive,
could you help me,
Version 3.22.11 + 200330
The topic has been locked.
- surveySn
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 136
- Thank you received: 4
3 years 4 months ago #208767
by surveySn
Replied by surveySn on topic Last Option In Array (Numbers) (Checkboxes) column Excludes All Others
Sorry, I changed my reply,
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
3 years 4 months ago #208769
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 Last Option In Array (Numbers) (Checkboxes) column Excludes All Others
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- surveySn
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 136
- Thank you received: 4
3 years 4 months ago #208771
by surveySn
Replied by surveySn on topic Last Option In Array (Numbers) (Checkboxes) column Excludes All Others
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
3 years 4 months ago #208789
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 Last Option In Array (Numbers) (Checkboxes) column Excludes All Others
Oh, an exclusive row...
Can you attach a small sample survey (.lss file) containing only that question?
Can you attach a small sample survey (.lss file) containing only that question?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- surveySn
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 136
- Thank you received: 4
3 years 4 months ago #208796
by surveySn
Replied by surveySn on topic Last Option In Array (Numbers) (Checkboxes) column Excludes All Others
SQ007_A and SQ007_B and SQ007_C and SQ007_D and SQ007_E and SQ007_F and SQ007_G It's exclusive
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
3 years 4 months ago - 3 years 4 months ago #208815
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 Last Option In Array (Numbers) (Checkboxes) column Excludes All Others
So, to be clear...
Every row is exclusive (only one answer per column) or the last row is exclusive (last row excludes all other answers in the same column)?
Every row is exclusive (only one answer per column) or the last row is exclusive (last row excludes all other answers in the same column)?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 3 years 4 months ago by tpartner.
The topic has been locked.
- surveySn
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 136
- Thank you received: 4
3 years 4 months ago #208823
by surveySn
Replied by surveySn on topic Last Option In Array (Numbers) (Checkboxes) column Excludes All Others
the last row is exclusive (last row excludes all other answers in the same column)
My English is poor and I don't express myself clearly,:kiss:
My English is poor and I don't express myself clearly,:kiss:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
3 years 4 months ago #208844
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 Last Option In Array (Numbers) (Checkboxes) column Excludes All Others
Add this script to the source of the question:
Here is a sample survey:
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify this question var qID = '{QID}'; var thisQuestion = $('#question'+qID); // Assign column-specific attributes and classnames $('tr.subquestion-list', thisQuestion).each(function(i) { $('> *', this).each(function(i) { $(this).attr('data-column', i); }); }); $('tr.subquestion-list:last td.answer-item', thisQuestion).addClass('exclusive-item'); // A function to un-check boxes function resetCheckbox(thisItem) { $(':hidden', thisItem).val(''); $(':checkbox', thisItem).prop('checked', false).trigger('change'); } // Listener on the checkboxes $(':checkbox', thisQuestion).on('change', function(e) { if($(this).is(':checked')) { var thisItem = $(this).closest('.answer-item'); var thisColumn = $(thisItem).attr('data-column'); var items = $('td.answer-item[data-column="'+thisColumn+'"].exclusive-item', thisQuestion); if($(thisItem).hasClass('exclusive-item')) { items = $('td.answer-item[data-column="'+thisColumn+'"]:not(.exclusive-item)', thisQuestion); } $.each(items, function(i, el) { resetCheckbox(el); }); } }); }); </script>
Here is a sample survey:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- surveySn
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 136
- Thank you received: 4
3 years 4 months ago #208856
by surveySn
Replied by surveySn on topic Last Option In Array (Numbers) (Checkboxes) column Excludes All Others
Great Tony,
thank you,
I have another question,
I play random sub problems,
fixed the last item,
Use your script,
Not the last row excludes
thank you,
I have another question,
I play random sub problems,
fixed the last item,
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // The subquestion code to place in the last position var fixedCode = 'A20'; // Identify this question var q1ID = {QID}; var thisQuestion = $('#question'+q1ID); // Move the "fixed" row to the end $('table.subquestion-list tbody:last', thisQuestion).append($('tr[id$="X'+q1ID+fixedCode+'"]')); // Fix up the array row background colours $('tr.answers-list', thisQuestion).each(function(i){ $(this).removeClass('array1 array2').addClass('array'+(2-(i%2))); }); }); </script>
Use your script,
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify this question var qID = '{QID}'; var thisQuestion = $('#question'+qID); // Assign column-specific attributes and classnames $('tr.subquestion-list', thisQuestion).each(function(i) { $('> *', this).each(function(i) { $(this).attr('data-column', i); }); }); $('tr.subquestion-list:last td.answer-item', thisQuestion).addClass('exclusive-item'); // A function to un-check boxes function resetCheckbox(thisItem) { $(':hidden', thisItem).val(''); $(':checkbox', thisItem).prop('checked', false).trigger('change'); } // Listener on the checkboxes $(':checkbox', thisQuestion).on('change', function(e) { if($(this).is(':checked')) { var thisItem = $(this).closest('.answer-item'); var thisColumn = $(thisItem).attr('data-column'); var items = $('td.answer-item[data-column="'+thisColumn+'"].exclusive-item', thisQuestion); if($(thisItem).hasClass('exclusive-item')) { items = $('td.answer-item[data-column="'+thisColumn+'"]:not(.exclusive-item)', thisQuestion); } $.each(items, function(i, el) { resetCheckbox(el); }); } }); }); </script>
Not the last row excludes
The topic has been locked.