Welcome to the LimeSurvey Community Forum

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

Segmenting sub-questions by category

More
8 years 11 months ago #119579 by dla
Hi,

I'm using Limesurvey for a social network analysis. Principle is to submit to respondants a list of >140 NPO names and ask them to click the buttons (4 types) that matches the kind of relationship they have with each NPO.

I attach 2 jpg to show the setting.

Since the list of NPO is quite long, I'd like to segment it into categories (e.g. "educational", "social", etc.) to make it easier for the respondants.

My question : How can I insert categories in this list ? For instance, between "ADC77" and "ADSEA AESF" (jpg) writing "Educational" without buttons and without entry in the database.

Thanks a lot for any suggestion!

David


The topic has been locked.
More
8 years 11 months ago #119584 by Ben_V
Replied by Ben_V on topic Segmenting sub-questions by category
If you need some inspiration:

1) you can adapt (ID, selectors, colspan, etc.) and try:
(have to be placed in the question, question help or elsewhere)
Code:
<script type="text/javascript" charset="utf-8">  
$(document).ready(function(){ 
$( "<tbody ><tr class='array1'><th class='answertext' >New Label</th><td colspan='5'></tr>" ).insertBefore( "#javatbdxxxxxx" );
});
</script>

2) Read this post and this one too

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.
More
8 years 11 months ago #119593 by dla
Replied by dla on topic Segmenting sub-questions by category
Thank you, it helps!
Would it be possible to put on the same row the category (e.g. INSERTION) and the header ?
pic 1 is what I get with your tweak, pic 2 is what would ideal...
Many thanks
David


The topic has been locked.
More
8 years 11 months ago #119602 by Ben_V
Replied by Ben_V on topic Segmenting sub-questions by category
Maybe:
Code:
<script type="text/javascript" charset="utf-8">  
$(document).ready(function(){ 
$( "<tbody ><tr class='array1'><th class='answertext' >New Label</th><td>connaissance</td><td>contacts</td><td>partenariats</td><td>sans réponse</td></tr>" ).insertBefore( "#javatbdxxxxxx" );
});
</script>

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 11 months ago #119605 by tpartner
Replied by tpartner on topic Segmenting sub-questions by category
Or to expand on Ben's thoughts, maybe something like this which inserts a modified clone of the header row.

Code:
<script type="text/javascript" charset="utf-8">  
  $(document).ready(function() {
 
    // Identify this question
    var thisQuestion = $('#question{QID}');
 
    // Create a new "sub-header" row
    var subHeader = $('table.subquestions-list thead tr:eq(0)', thisQuestion).clone();  
    $('td:eq(0)', subHeader).remove();
    subHeader.addClass('sub-header');
    subHeader.prepend('<th class="answertext">New Label</th>');  
 
    // Insert the new "sub-header" row
    $('#javatbdxxxxxx').after(subHeader);
  });    
</script>

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 11 months ago #119606 by dla
Replied by dla on topic Segmenting sub-questions by category
Thanks, it's almost that... But how to push to the right the labels "connaissance-contacts-partenariats-sans réponse" and adjust their size to the columns ?

Merci!
David

The topic has been locked.
More
8 years 11 months ago #119607 by dla
Replied by dla on topic Segmenting sub-questions by category
Thanks Tony, your suggestion crossed my answer to Benoît - and brought as well the solution. GREAT!
It just remains the almost neglectable issue of the very first sub-header (see pic below "New Label") that appear below the first row (AGISSONS). It should be someting like a up-header to come above the this first row and below the header.

Tony, I also see that you write in your codes "var thisQuestion = $('#question{QID}'" : what does it bring to enter QID here since it doesnt appear necessary?

Thanks to both of you

David

The following user(s) said Thank You: Ben_V
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 11 months ago #119608 by tpartner
Replied by tpartner on topic Segmenting sub-questions by category
Sorry, I don't understand what you want for a layout. Can you provide a mockup?

There is no need to replace {QID}, that is automatically parsed by Expression Manager.

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: Ben_V
The topic has been locked.
More
8 years 11 months ago #119611 by dla
Replied by dla on topic Segmenting sub-questions by category
Thanks.
What I mean is that the first sub-header sould be positionned ABOVE the first row, as in the pic below.
What is a mockup? Is this the lsq file of the question?

The topic has been locked.
More
8 years 11 months ago - 8 years 11 months ago #119612 by Ben_V
Replied by Ben_V on topic Segmenting sub-questions by category
In the worst case Tony will provide you with a smart code to hide this row... using javascript ;)

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last edit: 8 years 11 months ago by Ben_V.
The topic has been locked.
More
8 years 11 months ago #119613 by dla
Replied by dla on topic Segmenting sub-questions by category
Sure, but the delete key would do it as well ;)
The topic has been locked.
More
8 years 11 months ago #119615 by Ben_V
Replied by Ben_V on topic Segmenting sub-questions by category

dla wrote: ... {QID}'" : what does it bring to enter QID here since it doesnt appear necessary?


The complete list of available {keywords} (with allowed places to use) lives here

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The following user(s) said Thank You: dla
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose