Welcome to the LimeSurvey Community Forum

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

Miscellaneous questions about survey presentation (design / randomization)

  • syssecsurvey
  • syssecsurvey's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 9 months ago - 3 years 9 months ago #203002 by syssecsurvey
Dear LimeSurvey community,

Thanks to the help of this wonderful community, I already made great progress with my survey, but there are still some issues I cannot quite solve on my own.

Design / CSS issues
1. Is is possible to make only selected words bold in the column headers of array questions?
2. In "Multiple Choice with comment" questions, the answer text is aligned to the right if the answer takes up more than one line. Single-line answers are still left-aligned. How can I fix this?

Randomization issues
3. I have two multiple choice questions with the same set of answers. In general, the order of the answers should be randomized, but the order of the answers should be consistent between these two questions. I'm aware that the "Get order from previous question" functionality currently only is supported for Array (Numbers) questions (which, BTW, doesn't even work for this question type in my survey). Is there a workaround to manually replicate the "Get order from previous question" functionality for multiple choice questions?
4. I have two sets of question groups (G1, G2) about certain topics (letters A-H) and a rather complex mechanism shows participants up to 3 question groups from each set (say, G1-D, G1-F, G1-B, G2-F, G2-B, G2-D). The order in which the question groups within G1 and G2 are shown should be randomized. Currently I just have two randomization groups for G1 and G2, but tests revealed that participants were confused by the question groups in G2 not showing up in the same (randomized) order as those in G1. Is there a way to ensure that the second set of question groups is displayed in the same (randomized) order as the first set (G1-D, G1-F, G1-B, G2-D, G2-F, G2-B )?

Thanks a lot in advance!
Last edit: 3 years 9 months ago by syssecsurvey.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 9 months ago - 3 years 9 months ago #203012 by Joffm
Hi,

1. Is is possible to make only selected words bold in the column headers of array questions?

As headers are bold by default you may set the rest to "normal"
"<span style='font-weight:normal'>This is my </span>bold<span style='font-weight:normal'> header</span>"

In my opinion it is better to set all headers to "normal" in your theme.
Code:
.ls-answers .ls-heading th {
    font-weight: 400;
}

2. In "Multiple Choice with comment" questions, the answer text is aligned to the right if the answer takes up more than one line. Single-line answers are still left-aligned. How can I fix this?


Either you enter this in the question text or (without the <style> tags) in your custom.css.
In the second case all subquestions are left-aligned
Code:
<style>
.form-horizontal .control-label { text-align: left;}
</style>



Joffm

And of course the question: Which version are you using?

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 9 months ago by Joffm.
The following user(s) said Thank You: syssecsurvey
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 9 months ago #203014 by tpartner
3. If the questions are on the same page, this can be done directly with JavaScript.

If on separate pages, there are two options:
- Record the first question order in local memory and then apply it to the second question via JavaScript. This is easier but will not work across multiple devices.
- Record the first question order in a hidden question and then apply it to the second question via JavaScript. Slightly trickier but will work across multiple devices.


4. More or less the same answer as #3 but you will need to format the question codes so that there are corresponding identifiers in both groups.

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: syssecsurvey
The topic has been locked.
  • syssecsurvey
  • syssecsurvey's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 8 months ago #203245 by syssecsurvey
Thanks for your, as always, excellent advice!

@Joffm: I just tried both your suggestions and they work like a charm. Thanks!

@tpartner: Glad to learn this can be done! I think I need a little more detail on the "with JavaScript" part though. The questions are on the same page. The LimeSurvey version I use is 3.22.7+200225.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 8 months ago #203261 by tpartner
Can you attach a small sample survey (.lss file) containing only the relevant questions?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • syssecsurvey
  • syssecsurvey's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 8 months ago #203361 by syssecsurvey
Sure, see the attached *.lss file. I hope everything is self-explanatory. The problem areas look like this and these are instructions.

File Attachment:

File Name: randomizat...sues.lss
File Size:62 KB
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 8 months ago - 3 years 8 months ago #203388 by tpartner
To synchronize the answer rows of two consecutive array questions, place this script in the source of the second array:

Code:
<script type="text/javascript" charset="utf-8">  
  $(document).on('ready pjax:scriptcomplete',function(){
 
    // Identify some stuff
    var qID = '{QID}';
    var thisQuestion = $('#question'+qID);
    var prevQuestion = thisQuestion.prev('.question-container');
    var prevID = prevQuestion.attr('id').replace(/question/, '');
 
    // Loop through previous question rows
    $('tr[id^="javatbd"]', prevQuestion).each(function(i) {
      var thisCode = $(this).attr('id').split('X'+prevID)[1];
      // Move the row
      $('table.subquestion-list tbody', thisQuestion).append($('tr[id$="X'+qID+thisCode+'"]', thisQuestion));
    });
    });  
</script>

To synchronize the answer rows of two consecutive multiple-choice questions, place this script in the source of the second multiple-choice:

Code:
<script type="text/javascript" charset="utf-8">  
  $(document).on('ready pjax:scriptcomplete',function(){
 
    // Identify some stuff
    var qID = '{QID}';
    var thisQuestion = $('#question'+qID);
    var prevQuestion = thisQuestion.prev('.question-container');
    var prevID = prevQuestion.attr('id').replace(/question/, '');
 
    // Loop through previous question rows
    $('li[id^="javatbd"]', prevQuestion).each(function(i) {
      var thisCode = $(this).attr('id').split('X'+prevID)[1];
      // Move the row
      $('.answers-list ul:eq(0)', thisQuestion).append($('li[id$="X'+qID+thisCode+'"]', thisQuestion));
    });
    });  
</script>

Regarding "Is there a way to ensure that the second set of question groups is displayed in the same (randomized) order as the first set (G1-D, G1-F, G1-B, G2-D, G2-F, G2-B )?", I don't know how you expect me to demonstrate that if you provide a survey full of dummy questions.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 3 years 8 months ago by tpartner.
The topic has been locked.
  • syssecsurvey
  • syssecsurvey's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 8 months ago #203425 by syssecsurvey
Thank you! I just tried the first two solutions and everything works as desired.

Regarding the third issue: Since this is about the order in which different question groups are displayed, I thought that individual questions within each question group were not required and it would be sufficient to have differences in the names / descriptions of each question group. Could you please specify what I should add for you to be able to demonstrate the solution?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 8 months ago #203478 by tpartner
Sorry I misunderstood, I thought you wanted to control the order of answers in the following groups, not the order of the groups themselves.

Unfortunately, I don't have a solution.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose