- Posts: 19
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Fix two answers at last in multiple choice question showed with columns
- Oterito
- Topic Author
- Offline
- New Member
Less
More
2 months 2 weeks ago #255810
by Oterito
Fix two answers at last in multiple choice question showed with columns was created by Oterito
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.6.54
Own server or LimeSurvey hosting: Limesurvey hosting
Survey theme/template: fruity
==================
Hi! I want fix the last two options in a multiple choice question showed by 4 columns.
This code worked in 1 column, but when i select show in 4 columns it doesn't work anymore. <script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question var qID = {QID}; // Place the "DK" code option at the end of the list var answer = $( 'input[id$="X'+qID+'97"]'); var answerItem = $(answer).closest('li'); var answersList = $(answer).closest('ul'); $(answersList).append(answerItem); });
$(document).ready(function() { // Identify this question var qID = {QID}; // Place the "DK" code option at the end of the list var answer = $( 'input[id$="X'+qID+'99"]'); var answerItem = $(answer).closest('li'); var answersList = $(answer).closest('ul'); $(answersList).append(answerItem); });</script>
Can anyone help me please?
Thanks in advance
Your LimeSurvey version: 5.6.54
Own server or LimeSurvey hosting: Limesurvey hosting
Survey theme/template: fruity
==================
Hi! I want fix the last two options in a multiple choice question showed by 4 columns.
This code worked in 1 column, but when i select show in 4 columns it doesn't work anymore. <script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question var qID = {QID}; // Place the "DK" code option at the end of the list var answer = $( 'input[id$="X'+qID+'97"]'); var answerItem = $(answer).closest('li'); var answersList = $(answer).closest('ul'); $(answersList).append(answerItem); });
$(document).ready(function() { // Identify this question var qID = {QID}; // Place the "DK" code option at the end of the list var answer = $( 'input[id$="X'+qID+'99"]'); var answerItem = $(answer).closest('li'); var answersList = $(answer).closest('ul'); $(answersList).append(answerItem); });</script>
Can anyone help me please?
Thanks in advance
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
2 months 2 weeks ago #255815
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 Fix two answers at last in multiple choice question showed with columns
Can you attach a small sample survey (.lss file) containing only the relevant question?
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: Oterito
Please Log in to join the conversation.
- Oterito
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 0
2 months 2 weeks ago - 2 months 2 weeks ago #255818
by Oterito
Replied by Oterito on topic Fix two answers at last in multiple choice question showed with columns
Here I attach it. Thanks!
Last edit: 2 months 2 weeks ago by Oterito.
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
2 months 2 weeks ago #255821
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 Fix two answers at last in multiple choice question showed with columns
Do you want them fixed before or after the "Otros" item?
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: Oterito
Please Log in to join the conversation.
- Oterito
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 0
2 months 2 weeks ago #255822
by Oterito
Replied by Oterito on topic Fix two answers at last in multiple choice question showed with columns
After other option.
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
2 months 2 weeks ago - 2 months 2 weeks ago #255824
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 Fix two answers at last in multiple choice question showed with columns
This script will, for example, fix the sub-questions "97" and "99" to the end of the last column:
Sample survey attached:
Code:
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ // The subquestion codes to fix at the end var fixedCodes = ['97', '99']; // Identify this question var qID = '{QID}'; var thisQuestion = $('#question'+qID); var itemsLength = $('.answer-item', thisQuestion).length; var offset = 1; if($('.answer-item[id$="X'+qID+'other"]', thisQuestion).length > 0) { offset = 2; } // Move the fixed items $.each(fixedCodes, function(i, code) { var thisItem = $('.answer-item[id$="X'+qID+code+'"]', thisQuestion); var replacedItem = $('.answer-item:eq('+(itemsLength-i-offset)+')', thisQuestion); $(thisItem).before(replacedItem); $('.answers-list > ul:last', thisQuestion).append(thisItem); }); }); </script>
Sample survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 2 months 2 weeks ago by tpartner.
The following user(s) said Thank You: Oterito
Please Log in to join the conversation.
- Oterito
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 0
2 months 2 weeks ago #255826
by Oterito
Replied by Oterito on topic Fix two answers at last in multiple choice question showed with columns
It worked perfect. Thank you very much!
Please Log in to join the conversation.
- Oterito
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 0
2 months 2 weeks ago - 2 months 2 weeks ago #255905
by Oterito
Replied by Oterito on topic Fix two answers at last in multiple choice question showed with columns
Hi! tpartner! Its me again. I applied the same code in a second question with array filter by the first and i am having problems with the visualization. The options are not well distributed in columns. I attach an image below and a sample survey with two question.
Is there any way to solve this? Can you help me again please?
Thanks in advance!
Is there any way to solve this? Can you help me again please?
Thanks in advance!
Attachments:
Last edit: 2 months 2 weeks ago by Oterito.
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
2 months 2 weeks ago #255906
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 Fix two answers at last in multiple choice question showed with columns
That has nothing to do with my script. It is a core question behaviour - it does not visually handle filtering well when using columns.
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: DenisChenu, Oterito
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12941
- Thank you received: 3979
2 months 2 weeks ago #255912
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Fix two answers at last in multiple choice question showed with columns
As @tpartner,
the problem is in the order
First the subquestions are randomized and displayed in three columns
and THEN some are hidden by the array filter.
Here you see if you set the array filter mode to "deactivate"
Now imagine these subquestions are hidden.
If I remember well, I filed a bug report some years ago.
Joffm
the problem is in the order
First the subquestions are randomized and displayed in three columns
and THEN some are hidden by the array filter.
Here you see if you set the array filter mode to "deactivate"
Now imagine these subquestions are hidden.
If I remember well, I filed a bug report some years ago.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: Oterito
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
2 months 2 weeks ago #255933
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 Fix two answers at last in multiple choice question showed with columns
There is probably a CSS workaround but I'm away from a computer today.
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: DenisChenu
Please Log in to join the conversation.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13648
- Thank you received: 2491
2 months 2 weeks ago - 2 months 2 weeks ago #255961
by DenisChenu
(i mean : adding a new class and deactivate the core solution)
Else : doing it in HTML before show the question : gitlab.com/SondagesPro/QuestionSettingsType/arrayFilterHtml
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 Fix two answers at last in multiple choice question showed with columns
Maybe check with this solution : github.com/LimeSurvey/LimeSurvey/pull/3038There is probably a CSS workaround but I'm away from a computer today.
(i mean : adding a new class and deactivate the core solution)
Else : doing it in HTML before show the question : gitlab.com/SondagesPro/QuestionSettingsType/arrayFilterHtml
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.
Last edit: 2 months 2 weeks ago by DenisChenu.
The following user(s) said Thank You: tpartner, Oterito
Please Log in to join the conversation.