Welcome to the LimeSurvey Community Forum

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

Can I do a two scale array with numeric input ?

More
6 years 6 months ago #159091 by MaloF
I would like to create a question that has only numeric input cell as answers, and to be able to group column with a "subtitle".

I believe this can be seen as a two scale array with numeric values ?

Please see the attachment to fully get my point. In this case, I have two "subtitles" ( France/USA) , each having two column ( NB , ETP )

Is this possible ?

Thanks
Attachments:
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 6 months ago #159093 by Joffm
Hello, MaloF,

as far as I see, there is only a normal array(numbers), but with the additional headers.

I am sure somebody will be able to show how you can insert them.

Best regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
More
6 years 6 months ago #159096 by MaloF
Thanks Joffm, yes this is it, just a normal(Array) with additional headers .
I have no idea how to do it.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 6 months ago - 6 years 6 months ago #159113 by tpartner
Well, you could insert those extra headers with JavaScript but it would not work on mobile devices. Probably better to combine the countries with the existing headers or use 2 separate questions.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 6 months ago by tpartner.
The topic has been locked.
More
6 years 5 months ago #159168 by MaloF
Thanks Tony,

Could you show me how to do it via Javascript (or to point me to a similar answer with javascript code) ? Because I do not need mobile device compatibility and I can't combine the countries with the header as I need to do more complex table as the attached table .

Many thanks
Attachments:
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 5 months ago #159170 by Joffm
Well, instead of wasting too much time with these headers, why not just do it like this?
IMO you're always in a hurry when developing surveys.



That's easy, quickly implemented.

The same with your second table. Use different colors for cadres, ETAM, etc.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: MaloF
The topic has been locked.
More
6 years 5 months ago #159180 by MaloF
Thanks Joffm,

Your answer is OK to me . However I would like to proceed to a small adjustment in order to improve readability: I would like to insert a vertical line between each group ( so in your example between column 2 and 3).

I found this post : www.limesurvey.org/forum/can-i-do-this-w...or-an-array-question , but the proposed javascript code doesn't work for Array(Number).

Could you help me with this ?
Thanks
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 5 months ago #159209 by tpartner
Something like this will insert a vertical bar between columns 2 and 3.

Code:
<script type="text/javascript" charset="utf-8">  
 
  $(document).ready(function() {
 
    var newColPosition = 3;
 
    // Identify this question
    var thisQuestion = $('#question{QID}');
 
    // Insert a new column
    $('table.subquestion-list col:eq('+(newColPosition-1)+')', thisQuestion).after('<col class="inserted-column" />');
    $('table.subquestion-list thead th:eq('+(newColPosition-1)+')', thisQuestion).after('<th class="inserted-column" />');
    $('tr.subquestion-list', thisQuestion).each(function(i) {
      $('.question-item:eq('+(newColPosition-2)+')', this).after('<td class="inserted-column" />');
    });
 
    // Some styling
    $('.inserted-column', thisQuestion).css({
      'width': '1%',
      'background': '#233140',
      'padding': '0'
    });
  });
 
</script>


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: MaloF
The topic has been locked.
More
6 years 5 months ago #159213 by MaloF
Thank you Tony, that's perfect !
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose