Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Multiple question types in array

  • Stan
  • Stan's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 4 months ago #129560 by Stan
Replied by Stan on topic Multiple question types in array
Sorry holch and tpartner,

i didn't understood it that way. Here is an export of the sample survey. Thanks a lot.

File Attachment:

File Name: limesurvey...7256.lss
File Size:48 KB
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 4 months ago - 8 years 4 months ago #129574 by tpartner
Replied by tpartner on topic Multiple question types in array
Add this script to the first question of each pair you want to display side-by-side. Note that some of the selectors and styles in this script are specific to the default template so may need to be changed for other templates.

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>

Here is an abbreviated version of your survey with the script in the source of questions 2 and 5:

File Attachment:

File Name: limesurvey...7256.lss
File Size:24 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 8 years 4 months ago by tpartner.
The following user(s) said Thank You: Stan
The topic has been locked.
  • Stan
  • Stan's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 3 months ago #129593 by Stan
Replied by Stan on topic Multiple question types in array
Waouh! Thanks a lot, tpartner.
The topic has been locked.
More
8 years 2 months ago #131673 by Babilu
Replied by Babilu on topic Multiple question types in array
Hi all,
I am trying to use the "Multiple question types in array" workaround for my survey but it seems that does not work in LS Version 2.50+ Build 160215.
I found this topic and I'ved tryed your example but the two questions are not displayed in the same but consequently.
Probably I missed something that I do not know, I've just created two survey one with the lss provided by the manual and the second provided in this topic. In both the cases the output is a single column of data .
Do you have any suggestions?
Thanks for the support.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 2 months ago #131676 by tpartner
Replied by tpartner on topic Multiple question types in array
Unfortunately, the structure of the questions was changed in version 2.50 breaking that and presumably many more workarounds.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
8 years 2 months ago #131681 by Babilu
Replied by Babilu on topic Multiple question types in array
thanks for the quick reply
:ohmy: Now I just have to bang my head against the wall since I'm not a programmer.
thanks again
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 2 months ago #131803 by DenisChenu
Replied by DenisChenu on topic Multiple question types in array
You can download the old version (2.06) and use the workaround again.

Just replace the version : DB is OK, you have surely some issue when updating to 2.50 again.

Denis

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.
More
8 years 2 months ago #131846 by Babilu
Replied by Babilu on topic Multiple question types in array
It works! :cheer:
Thanks guys for the support.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose