Welcome to the LimeSurvey Community Forum

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

Array headings with subheadings

  • krosser
  • krosser's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
5 years 9 months ago #182139 by krosser
Array headings with subheadings was created by krosser
Hi guys!

I would like to make such an array with subheadings (see the pic below). Unfortunately, I have not found a similar thread on the forum. If anyone knows a JS script, please share. Thanks!


I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 9 months ago #182156 by tpartner
Replied by tpartner on topic Array headings with subheadings
The full-size array should only take a little basic jQuery manipulation but how do you want it to behave on smaller devices (phones)?

Can you attach a small sample survey containing only that array?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • krosser
  • krosser's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
5 years 9 months ago #182168 by krosser
Replied by krosser on topic Array headings with subheadings

tpartner wrote: The full-size array should only take a little basic jQuery manipulation but how do you want it to behave on smaller devices (phones)?

Can you attach a small sample survey containing only that array?


Well, good point about smaller devices. It seems that this change would mess up rendering. I don't know whether it is possible to manage rendering of subheadings for both subquestion and answer axes. Because for subquestions it would be possible to place the heading on top of each subquestion-answer choice box.
But hopefully the survey is going to be used only on bigger screens.

The sample survey attached.

File Attachment:

File Name: limesurvey...5916.lss
File Size:19 KB

I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 9 months ago #182190 by holch
Replied by holch on topic Array headings with subheadings

But hopefully the survey is going to be used only on bigger screens.


Unfortunately, this is rather wishful thinking. I just ran a survey among company employees and we specifically told them that they should answer on ther computer or notebook and not on a tablet or a smartphone, because one of the questions was an array with 7 columns (number input) and a variable amount of lines (subquestions in Limesurvey).

But even when stated in the email and in the introduction text of the survey, there are always people who will not read it and then wonder, why it takes them so long to fill in the questionnaire.

Surveys are generally not their primary concern and many people do it when they don't have much to do, so while they are commuting, waiting somewhere, etc. That is when they use their mobile phone.

It is difficult for us researcher, because sometimes a "nice" matrix question seems to be the obvious and easy solution, but with the mobile trend it is getting more an dmore difficult to use those type of questions. In my case I knew the respondents, they might even get in contact if something went wrong and I have sent them about 10.000.000 reminders and the company directors and area managers were interested that they fill the survey and that the response rate is high. But if you are running a survey with the general public, they might just leave your survey unanswered, if it is too complicated.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 9 months ago #182196 by tpartner
Replied by tpartner on topic Array headings with subheadings
To add those headers, place something like this in the source of the question:

Code:
<script type="text/javascript" charset="utf-8">
 
  $(document).on('ready pjax:scriptcomplete',function(){
    // Insert the column categories
    $('#question{QID} table.subquestion-list thead tr:eq(0) td:eq(0)').remove();
    $('#question{QID} table.subquestion-list thead').prepend('<tr class="ls-heading">\
                                  <td rowspan="2" colspan="2"></td>\
                                  <th class="answer-text inserted-header" colspan="3">Category 1</th>\
                                  <th class="answer-text inserted-header" colspan="3">Category 2</th>\
                                </tr>');
    // Insert the row categories
    $('#question{QID} table.subquestion-list colgroup').remove();
    $('#question{QID} table.subquestion-list tr.answers-list:eq(0)').prepend('<th class="answertext inserted-header" rowspan="2">Category 1</th>');
    $('#question{QID} table.subquestion-list tr.answers-list:eq(2)').prepend('<th class="answertext inserted-header" rowspan="2">Category 2</th>');
  });  
</script>



Sample survey attached:

File Attachment:

File Name: limesurvey...9161.lss
File Size:21 KB


If you want to disable the table transformations on smaller screens, see this post - www.limesurvey.org/forum/design-issues/1...ransformation#180555

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: krosser
The topic has been locked.
  • krosser
  • krosser's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
5 years 9 months ago #182230 by krosser
Replied by krosser on topic Array headings with subheadings
Many thanks, Tony.
Can you please help with adapting the code to the Array (Numbers)?
I have managed the columns part, but cannot figure out the rows.
Code:
<script type="text/javascript" charset="utf-8">
 
  $(document).on('ready pjax:scriptcomplete',function(){
    // Insert the column categories
    $('#question{QID} table.subquestion-list thead tr:eq(0) td:eq(0)').remove();
    $('#question{QID} table.subquestion-list thead').prepend('<tr class="ls-heading">\
                                  <td rowspan="2" colspan="1"></td>\
                                  <th class="answer-text inserted-header" colspan="3">Category 1</th>\
                                  <th class="answer-text inserted-header" colspan="3">Category 2</th>\
                                </tr>');
    // Insert the row categories
 
  });  
</script>


Sample survey attached too.

File Attachment:

File Name: limesurvey...7133.lss
File Size:21 KB

I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
The topic has been locked.
More
4 years 10 months ago - 4 years 10 months ago #194702 by stephanieteresa93
Replied by stephanieteresa93 on topic Array headings with subheadings
Hi,

I have copy /pasted this code into my survey. Attached you will see a preview of how it turned out. Is there a way to make sure that Twin 1 and Twin 2 is centred with the answer options?

Thank you,
Stephanie
Last edit: 4 years 10 months ago by stephanieteresa93.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 10 months ago #194707 by holch
Replied by holch on topic Array headings with subheadings
Please do not crosspost. You have asked this question in a separate post already.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 10 months ago #194715 by tpartner
Replied by tpartner on topic Array headings with subheadings
Can you attach a small sample survey (.lss file) containing only that question and your code?

Cheers,
Tony Partner

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

Lime-years ahead

Online-surveys for every purse and purpose