Welcome to the LimeSurvey Community Forum

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

Adding 2 others field for multiple choice question

  • Sabrina2017
  • Sabrina2017's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 3 months ago #146508 by Sabrina2017
Hi,

I have two requests :

1- Adding 2 others field for multiple choice question (please see attachement *query 1)
2- Layout for response with two different language and checkbox imput in center(please see attachement *query 2)

Thank You
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 3 months ago #146512 by tpartner
What LimeSurvey version and template?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Sabrina2017
  • Sabrina2017's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 3 months ago #146513 by Sabrina2017
Replied by Sabrina2017 on topic Adding 2 others field for multiple choice question
Version 2.57.1+161205
default template
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 3 months ago - 7 years 3 months ago #146532 by tpartner
1) Use a Multiple choice with comments type question and hide some of the text inputs with JavaScript or CSS. See this post - www.limesurvey.org/forum/can-i-do-this-w...oice-question#146117

2) You will have to manipulate the labels with CSS and/or JavaScript. I'll have to give a little thought as how to best do that.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 7 years 3 months ago by tpartner.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 3 months ago - 7 years 3 months ago #146540 by tpartner
I think for #2, in order to maintain vertical alignment, you will need to insert a table and move the answer elements into table rows.

Wrap the French and English portions of the sub-question labels in <span> elements with classes "label-fr" and "label-en"

Add this script to the question text:

Code:
<script type="text/javascript" charset="utf-8">    
 
  $(document).ready(function() {
 
    // Identify this question
    var thisQuestion = $('#question{QID}');
 
    // Insert a table
    $('.subquestion-list', thisQuestion).after('<table class="bilingual-list" />');
 
    // Insert table rows
    $('.question-item', thisQuestion).each(function(i) {
      $('.bilingual-list', thisQuestion).append('<tr class="inserted-row-'+i+'">\
                              <td class="inserted-label-fr" />\
                              <td class="inserted-answer" />\
                              <td class="inserted-label-en" />\
                            </tr>');
      $('.inserted-row-'+i+' .inserted-answer', thisQuestion).append(this);
      $('.inserted-row-'+i+' .inserted-label-fr', thisQuestion).append($('.label-fr', this));
      $('.inserted-row-'+i+' .inserted-label-en', thisQuestion).append($('.label-en', this));
    });
 
    // Some styling
    $('table.bilingual-list', thisQuestion).css({
      'width': 'auto'
    });
    $('table.bilingual-list td', thisQuestion).css({
      'padding-top': '5px',
      'padding-bottom': '5px'
    });
    $('td.inserted-answer .question-item', thisQuestion).css({
      'margin': '0',
      'padding-left': '40px'
    });
    $('td.inserted-answer .label-clickable', thisQuestion).css({
      'display': 'none'
    });
  });
</script>



Sample survey attached:

File Attachment:

File Name: limesurvey...4966.lss
File Size:17 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 7 years 3 months ago by tpartner.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose