- Posts: 21
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Move questions to be next to each other
- honorem
- Topic Author
- Offline
- Junior Member
Less
More
7 years 11 months ago - 7 years 11 months ago #134729
by honorem
Move questions to be next to each other was created by honorem
Is it possible to move a question next to an other question?
Suppose I have a list radio question with some answers, now I'd like to move a multiple choice question to be next (next as not under but beside the other question...) to the radio question, is it possible? And If so, there would be some javascript for this which is sadly out of my knowledge.
I guess this could be done with an array question as well, where one of the columns is multiple choice and the other one radio list, the question text would be the same for both which is what Im after really..
Suppose I have a list radio question with some answers, now I'd like to move a multiple choice question to be next (next as not under but beside the other question...) to the radio question, is it possible? And If so, there would be some javascript for this which is sadly out of my knowledge.
I guess this could be done with an array question as well, where one of the columns is multiple choice and the other one radio list, the question text would be the same for both which is what Im after really..
Last edit: 7 years 11 months ago by honorem.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
7 years 11 months ago #134735
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 Move questions to be next to each other
Have a look at this post for inspiration -
www.limesurvey.org/forum/design-issues/1...ypes-in-array#129574
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: honorem
The topic has been locked.
- honorem
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 21
- Thank you received: 0
7 years 11 months ago #134761
by honorem
Inspiration? It does exactly what I was after, without any modifications, excellent tdpartner :laugh:. And I thought I had searched the forum very well, guess not. You code is very pedagogical, but i don't understand the function equalizeHeights(), is it a fix for something and if so, what is it fixing?
However, if anyone stumble into tis question take a look at tdpartner's answer on above link, or the spoiler below.
Replied by honorem on topic Move questions to be next to each other
tpartner wrote: Have a look at this post for inspiration - www.limesurvey.org/forum/design-issues/1...ypes-in-array#129574
Inspiration? It does exactly what I was after, without any modifications, excellent tdpartner :laugh:. And I thought I had searched the forum very well, guess not. You code is very pedagogical, but i don't understand the function equalizeHeights(), is it a fix for something and if so, what is it fixing?
However, if anyone stumble into tis question take a look at tdpartner's answer on above link, or the spoiler below.
Warning: Spoiler!
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify the questions var thisQuestion = $('#question{QID}'); var nextQuestion = $(thisQuestion).nextAll('div[id^="question"]:eq(0)'); var theseQuestions = $(thisQuestion).add(nextQuestion); // Place the questions side-by side $(theseQuestions).wrapAll('<div style="width:75%; margin: 0 auto" />'); theseQuestions.css({ 'float': 'left', 'width': '50%' }); $('> table', theseQuestions).css({ 'width': '100%' }); // Some styling for the textareas $('textarea', theseQuestions).removeAttr('cols').css({ 'margin-left': '0', 'margin-right': '0', 'width': '100%' }); // Equalize heights if($(thisQuestion).is(':hidden')) { $(theseQuestions).css({ 'position': 'absolute', 'left': '-9999em' }).show(); equalizeHeights(); $(theseQuestions).css({ 'position': 'relative', 'left': 'auto' }).hide(); } else { equalizeHeights(); } function equalizeHeights() { var questionTextHeight = 0; $('td.questiontext', theseQuestions).each(function(i) { if($(this).height() > questionTextHeight) { questionTextHeight = $(this).height() } $('td.questiontext', theseQuestions).height(questionTextHeight); }); var answerHeight = 0; $('td.answer', theseQuestions).each(function(i) { if($(this).height() > answerHeight) { answerHeight = $(this).height() } $('td.answer', theseQuestions).height(answerHeight); }); var helpHeight = 0; $('td.survey-question-help', theseQuestions).each(function(i) { if($(this).height() > helpHeight) { helpHeight = $(this).height() } $('td.survey-question-help', theseQuestions).height(helpHeight); }); } }); </script>
The topic has been locked.