Welcome to the LimeSurvey Community Forum

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

Titles for subquestions

  • cstcandy
  • cstcandy's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 2 months ago #147293 by cstcandy
Titles for subquestions was created by cstcandy
Hi there.

1) I would like to add and display subtitles to divide the sub-questions into several groups, so that it will be more reader-friendly and respondents can easily find their answers. If there is a solution, would it be different for multiple choice VS. list radio question?
For example, if the question is "Which country do you live in?.", the sub-questions will be displayed in the way like:
Asia
China □
Taiwan □
Thailand □
Singapore □
Malaysia □
Europe
UK □
USA □

2) If I would like to have randomization within each groups of subquestions, are there any solutions?


Appreciated for any response. :)
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
7 years 2 months ago #147305 by LouisGac
Replied by LouisGac on topic Titles for subquestions
can be done with JavaScript.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 2 months ago #147320 by DenisChenu
Replied by DenisChenu on topic Titles for subquestions
Easy without 2 (randomization) : there are surely some published workarounds in manual

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
More
7 years 2 months ago #147325 by Ben_V
Replied by Ben_V on topic Titles for subquestions

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: DenisChenu
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 2 months ago #147359 by holch
Replied by holch on topic Titles for subquestions
@Ben_V: I tried the solution posted there (from Tpartner) and it wohnt work in LS 2.59.1. I guess the solution is for the 2.06 / 2.6 branch?

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.
More
7 years 2 months ago #147361 by Ben_V
Replied by Ben_V on topic Titles for subquestions
Probably some selectors have changed..but sounds easy to adapt. This said, I cannot test because I do not have the recent cited version installed anywhere.

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.
  • cstcandy
  • cstcandy's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 2 months ago - 7 years 2 months ago #147371 by cstcandy
Replied by cstcandy on topic Titles for subquestions
I have tried the following script. Can I assume the number in bracket "eq(#)" is the row of the subtitle? I have modified the numbers according to my survey and didn't change anything else (sorry I am not familar with JS). It is not working, which my survey still displays the answer options as usual.
Code:
<script charset="utf-8" type="text/javascript">      
  $(document).ready(function() {  
 
    $( '#question{QID} li.question-item:eq(0) input.checkbox').css ({                     
      'display': 'none' 
    });
    $( 'question{QID} li.question-item:eq(5) input.checkbox').css ({                     
      'display': 'none' 
    });
    $( 'question{QID} li.question-item:eq(10) input.checkbox').css ({                     
      'display': 'none' 
    });
    $( 'question{QID} li.question-item:eq(15) input.checkbox').css ({                     
      'display': 'none' 
    });
    $( 'question{QID} li.question-item:eq(19) input.checkbox').css ({                     
      'display': 'none' 
    });
    $( 'question{QID} li.question-item:eq(23) input.checkbox').css ({                     
      'display': 'none' 
    });
    $( 'question{QID} li.question-item:eq(29) input.checkbox').css ({                     
      'display': 'none' 
    });
  });
</script>
Last edit: 7 years 2 months ago by DenisChenu. Reason: spoiler => code
The topic has been locked.
  • cstcandy
  • cstcandy's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 2 months ago #147372 by cstcandy
Replied by cstcandy on topic Titles for subquestions
Sorry, didn't manage to paste the script properly.
The topic has been locked.
  • cstcandy
  • cstcandy's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 2 months ago #147377 by cstcandy
Replied by cstcandy on topic Titles for subquestions
I just tried the script and use default template in my survey. The script works!
So I wonder it is the problem of my designed template. Any specific script to be added in the template.css?

Thanks!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 2 months ago - 7 years 2 months ago #147393 by tpartner
Replied by tpartner on topic Titles for subquestions
In version 2.5x, there are pseudo-elements inserted for the check-boxes and you can't reliably use JavaScript to apply styles to a pseudo-element.

The simplest approach is to apply classes to the row elements and target the pseudo-elements in those rows with CSS. You should also remove the check-boxes in those rows in case someone tabs through the question.

1) Add something like this to the question source:
Code:
<script type="text/javascript" charset="utf-8">    
 
  $(document).ready(function() {
    // First Row
    $('#question{QID} .question-item:eq(0)').parent().addClass('sub-header');
    $('#question{QID} .question-item:eq(0)').find('input').remove();
    // Sixth Row
    $('#question{QID} .question-item:eq(5)').parent().addClass('sub-header');
    $('#question{QID} .question-item:eq(5)').find('input').remove();
    // Tenth Row
    $('#question{QID} .question-item:eq(11)').parent().addClass('sub-header');
    $('#question{QID} .question-item:eq(11)').find('input').remove();
  });
</script>

2) Add something like this to the end of template.css:
Code:
.multiple-opt .sub-header .question-item {
  padding-left: 0;
}
 
.multiple-opt .sub-header .label-text {
  margin-left: 0;
  font-weight: bold;
}
 
.multiple-opt .sub-header .checkbox label::before {
  display: none;
}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 7 years 2 months ago by tpartner.
The following user(s) said Thank You: Ben_V, LouisGac
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 2 months ago #147412 by holch
Replied by holch on topic Titles for subquestions
I think we should have such titles as a feature in Limesurvey, especially for multi answer, list radio and Array.

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

The following user(s) said Thank You: cstcandy
The topic has been locked.
  • cstcandy
  • cstcandy's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 2 months ago #147471 by cstcandy
Replied by cstcandy on topic Titles for subquestions
Thanks for your help.
But it still doesn't work in my own template... (I am not the one who designed the template so I cannot find out the problem niether.)
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose