- Posts: 2
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Different answer choices for each subquestion
- AudreyLP
- Topic Author
- Offline
- New Member
Less
More
1 year 1 month ago #242334
by AudreyLP
Different answer choices for each subquestion was created by AudreyLP
Please help us help you and fill where relevant:
Your LimeSurvey version: Version 5.6.14+230403
Own server or LimeSurvey hosting:
Survey theme/template:
==================
Hi,
I am trying to show different answer choices for each subquestion of a "Array Type F" question.
The rows would present the subquestions, and the columns, the answer choices that would vary for each row.
The user would select an answer choice for each subquestion.
Is it possible on LimeSurvey? Or do I have to create an independent question for each subquestion?
Thank you!
Your LimeSurvey version: Version 5.6.14+230403
Own server or LimeSurvey hosting:
Survey theme/template:
==================
Hi,
I am trying to show different answer choices for each subquestion of a "Array Type F" question.
The rows would present the subquestions, and the columns, the answer choices that would vary for each row.
The user would select an answer choice for each subquestion.
Is it possible on LimeSurvey? Or do I have to create an independent question for each subquestion?
Thank you!
Please Log in to join the conversation.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11697
- Thank you received: 2750
1 year 1 month ago #242335
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Different answer choices for each subquestion
A normal array in Limesurvey has a fixed x and y axis.
You can't have different answer options per subquestion out of the box.
You might have to create questions with one subquestion each and their own individual answer labels.
You can't have different answer options per subquestion out of the box.
You might have to create questions with one subquestion each and their own individual answer labels.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Please Log in to join the conversation.
- AudreyLP
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
1 year 1 month ago #242337
by AudreyLP
Replied by AudreyLP on topic Different answer choices for each subquestion
Thank you for your answer!
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13031
- Thank you received: 4007
1 year 1 month ago - 1 year 1 month ago #242338
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Different answer choices for each subquestion
To add something to holch's answer.
You can merge the questions by css classes "no-question" and "no-bottom".
Search the forum for the definition.
Other approach.
Insert subheaders by javascript
Here the script that you have to adapt to your answer options.
and some css
Joffm
You can merge the questions by css classes "no-question" and "no-bottom".
Search the forum for the definition.
Other approach.
Insert subheaders by javascript
Here the script that you have to adapt to your answer options.
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question var thisQuestion = $('#question{QID}'); // Define the sub-heading text strings var subHeading1 = '<th></th><th>AA 1</th><th>AA 2</th><th>AA 3</th><th>AA 4</th><th>AA 5</th><th>AA 6</th><th>AA 7</th>'; var subHeading2 = '<th></th><th>AB 1</th><th>AB 2</th><th>AB 3</th><th>AB 4</th><th>AB 5</th><th>AB 6</th><th>AB 7</th>'; var subHeading3 = '<th></th><th>CA 1</th><th>CA 2</th><th>CA 3</th><th>CA 4</th><th>CA 5</th><th>CA 6</th><th>CA 7</th>'; // Insert the new rows $('tr.answers-list:eq(0)', thisQuestion).before('<tr class="sub-header-row">'+subHeading1+'</tr>'); $('tr.answers-list:eq(1)', thisQuestion).before('<tr class="sub-header-row">'+subHeading2+'</tr>'); $('tr.answers-list:eq(2)', thisQuestion).before('<tr class="sub-header-row">'+subHeading3+'</tr>'); // Fix up the row classes var rowClass = 1; $('table.subquestions-list tbody tr', thisQuestion).each(function(i) { if($(this).hasClass('sub-header-row')) { rowClass = 1 } else { rowClass++; $(this).removeClass('array1 array2') if(rowClass % 2 == 0) { $(this).addClass('array2'); } else { $(this).addClass('array1'); } } }); }); </script>
and some css
Code:
<style type="text/css">.sub-header-row { margin-bottom: 20px; } .sub-header-row th { background-color: #efefef; color: #000000 !important; text-align: center; } tr.ls-heading { display:none; } </style>
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 year 1 month ago by Joffm.
The following user(s) said Thank You: DenisChenu, holch
Please Log in to join the conversation.