- Posts: 8
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Dual Scale Array, getting rid of one side for one question
- rickyd
-
Topic Author
- Offline
- New Member
-
Less
More
8 years 3 months ago #121992
by rickyd
Dual Scale Array, getting rid of one side for one question was created by rickyd
Hello,
I'm trying to create a dual scale array question with many similar subquestions. For one subquestion, however, I'd like to get rid of the first scale's radio buttons and only have radio buttons in the second. I could just create another question, however for the sake of the look of the survey I'd rather have everything all together in one question. Is this something that is possible? Thank you.
I'm trying to create a dual scale array question with many similar subquestions. For one subquestion, however, I'd like to get rid of the first scale's radio buttons and only have radio buttons in the second. I could just create another question, however for the sake of the look of the survey I'd rather have everything all together in one question. Is this something that is possible? Thank you.
The topic has been locked.
- tpartner
-
- Offline
- LimeSurvey Community Team
-
Less
More
- Posts: 10356
- Thank you received: 3585
8 years 3 months ago - 8 years 3 months ago #122018
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Dual Scale Array, getting rid of one side for one question
Set up your survey to use JavaScript
and add something like this to the source of the question (modify rowNumber as required):
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // The row to hide var rowNumber = 2; // Identify some elements var thisQuestion = $('#question{QID}'); var hiddenRow = $('tr.radio-list:eq('+(rowNumber-1)+')', thisQuestion); // Assign column-specific classes $('tr.radio-list', thisQuestion).each(function(i){ var column = 1; var scale = 1; $('td', this).each(function(i){ if($(this).hasClass('radio-item')) { $(this).addClass('scale-'+scale+' column-'+column+''); column++; } else { column = 1; scale = 2; } }); }); // Click the first radio in the hidden row (in case of mandatory) $('.column-1.scale-1 input.radio', hiddenRow).trigger('click'); // Hide the radios $('.scale-1 input.radio', hiddenRow).hide(); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 8 years 3 months ago by tpartner.
The topic has been locked.
- DerBibber17
-
- Offline
- Junior Member
-
Less
More
- Posts: 22
- Thank you received: 1
6 years 1 week ago #158943
by DerBibber17
Replied by DerBibber17 on topic Dual Scale Array, getting rid of one side for one question
Hey!
I have a similar question. I want some of the subquestions in my arrays (numbers with checkboxes) or multiple choice questions only to be category separators (like it is possible to choose for list dropdown). As far as I can see limesurvey is not offering category separators in arrays or multiple choice questions.
So my idea would be to hide the checkboxes (of an array) or the radio buttons (of a multiple choice) in the rows that should only be headers for the following subquestions.
My JavaScript skills are kind of limited, so I would be grateful for some help.
I have a similar question. I want some of the subquestions in my arrays (numbers with checkboxes) or multiple choice questions only to be category separators (like it is possible to choose for list dropdown). As far as I can see limesurvey is not offering category separators in arrays or multiple choice questions.
So my idea would be to hide the checkboxes (of an array) or the radio buttons (of a multiple choice) in the rows that should only be headers for the following subquestions.
My JavaScript skills are kind of limited, so I would be grateful for some help.
The topic has been locked.
- Joffm
-
- Offline
- LimeSurvey Community Team
-
Less
More
- Posts: 11769
- Thank you received: 3639
6 years 1 week ago #159001
by Joffm
For multiple choice maybe this helps (Tony's script).
www.limesurvey.org/forum/can-i-do-this-w...e-in-multiple-choice
Regards
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Dual Scale Array, getting rid of one side for one question
I want some of the subquestions in my arrays (numbers with checkboxes) or multiple choice questions only to be category separators
For multiple choice maybe this helps (Tony's script).
www.limesurvey.org/forum/can-i-do-this-w...e-in-multiple-choice
Regards
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DerBibber17
The topic has been locked.
- tpartner
-
- Offline
- LimeSurvey Community Team
-
Less
More
- Posts: 10356
- Thank you received: 3585
6 years 1 week ago - 6 years 1 week ago #159010
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Dual Scale Array, getting rid of one side for one question
Regarding arrays, rather than hiding check-boxes, I would insert new sub-header rows. Something like this -
www.limesurvey.org/forum/design-issues/1...-one-question#155220
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 1 week ago by tpartner.
The topic has been locked.
- tpartner
-
- Offline
- LimeSurvey Community Team
-
Less
More
- Posts: 10356
- Thank you received: 3585
6 years 1 week ago #159011
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Dual Scale Array, getting rid of one side for one question
...here is that JavaScript, modified slightly for array-numbers-checkboxes:
And, the CSS:
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 = 'Subheading 1'; var subHeading2 = 'Subheading 2'; var columnsLength = $('tr.subquestion-list:eq(0) > *', thisQuestion).length; // Insert the new rows $('tr.subquestion-list:eq(0)', thisQuestion).before('<tr class="sub-header-row"><th colspan="'+columnsLength+'">'+subHeading1+'</th></tr>'); $('tr.subquestion-list:eq(2)', thisQuestion).before('<tr class="sub-header-row"><th colspan="'+columnsLength+'">'+subHeading2+'</th></tr>'); // Fix up the row classes var rowClass = 1; $('table.subquestion-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, the CSS:
Code:
.sub-header-row { margin-bottom: 20px; } .sub-header-row th { background-color: #547599; color: #FFFFFF !important; text-align: center; }
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The topic has been locked.
- DerBibber17
-
- Offline
- Junior Member
-
Less
More
- Posts: 22
- Thank you received: 1
6 years 1 week ago #159053
by DerBibber17
Replied by DerBibber17 on topic Dual Scale Array, getting rid of one side for one question
Thank you for the script
Unfortunately it's not working. I inserted the script into the source of the question but nothing happens. I also tried some other things (like adding an "other"-option with textfield to some of my question), but nothing is working.
So i was wondering, if the problem is that I'm using limesurvey via my University which is offering only the german limesurvey version while the scripts are in english. Could this be part of the problem?

So i was wondering, if the problem is that I'm using limesurvey via my University which is offering only the german limesurvey version while the scripts are in english. Could this be part of the problem?
The topic has been locked.
- tpartner
-
- Offline
- LimeSurvey Community Team
-
Less
More
- Posts: 10356
- Thank you received: 3585
6 years 1 week ago #159055
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Dual Scale Array, getting rid of one side for one question
The script language does not matter.
See here for instructions on how to insert scripts - manual.limesurvey.org/Workarounds:_Manip...tc..29_in_LimeSurvey
See here for instructions on how to insert scripts - manual.limesurvey.org/Workarounds:_Manip...tc..29_in_LimeSurvey
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- DerBibber17
-
- Offline
- Junior Member
-
Less
More
- Posts: 22
- Thank you received: 1
6 years 6 days ago #159107
by DerBibber17
Replied by DerBibber17 on topic Dual Scale Array, getting rid of one side for one question
Ok so I don't know why it's not working.
Do I have to change something in the script when I'm using it in my question (except the Subheadings)?
Do I have to change something in the script when I'm using it in my question (except the Subheadings)?
The topic has been locked.
- tpartner
-
- Offline
- LimeSurvey Community Team
-
Less
More
- Posts: 10356
- Thank you received: 3585
6 years 6 days ago #159110
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Dual Scale Array, getting rid of one side for one question
Can you activate a test survey and give a link here?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- DerBibber17
-
- Offline
- Junior Member
-
Less
More
- Posts: 22
- Thank you received: 1
6 years 4 days ago #159155
by DerBibber17
Replied by DerBibber17 on topic Dual Scale Array, getting rid of one side for one question
In the meanwhile I got a new problem. I couldn't activate my survey because I've got to many subquestions in it. So here's a link to just one question group of my survey.
In this group are for example 3 questions in which I would like to use sub-headers. One question with multiple numerical input and two arrays (I already changed the multiflex arrays so I dont need sub-headers in them anymore). The bold subquestion you see now should be only subheaders.
Thank you so much!
survey.tugraz.at/index.php/survey/index/...65/newtest/Y/lang/de
In this group are for example 3 questions in which I would like to use sub-headers. One question with multiple numerical input and two arrays (I already changed the multiflex arrays so I dont need sub-headers in them anymore). The bold subquestion you see now should be only subheaders.
Thank you so much!
survey.tugraz.at/index.php/survey/index/...65/newtest/Y/lang/de
The topic has been locked.
- Joffm
-
- Offline
- LimeSurvey Community Team
-
Less
More
- Posts: 11769
- Thank you received: 3639
6 years 4 days ago - 6 years 4 days ago #159156
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Dual Scale Array, getting rid of one side for one question
Hello, Bibber,
and this (where does the subheading appear):
I got this result:
And this for your "normal" matrix (without any css to style the header row)
sample file attached
Best regards
Joffm
You have to change this:Do I have to change something in the script when I'm using it in my question (except the Subheadings)?
Code:
// Define the sub-heading text strings var subHeading1 = 'Subheading 1'; var subHeading2 = 'Subheading 2'; var subHeading3 = 'My third subheading';
Code:
// Insert the new rows $('tr.subquestion-list:eq(0)', thisQuestion).before('<tr class="sub-header-row"><th colspan="'+columnsLength+'">'+subHeading1+'</th></tr>'); $('tr.subquestion-list:eq(2)', thisQuestion).before('<tr class="sub-header-row"><th colspan="'+columnsLength+'">'+subHeading2+'</th></tr>'); $('tr.subquestion-list:eq(5)', thisQuestion).before('<tr class="sub-header-row"><th colspan="'+columnsLength+'">'+My third subHeading+'</th></tr>');
I got this result:
And this for your "normal" matrix (without any css to style the header row)
sample file attached
Well, that's something different. So either you try to shorten your survey or you have to split it.In the meanwhile I got a new problem. I couldn't activate my survey because I've got to many subquestions in it.
Best regards
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
Last edit: 6 years 4 days ago by Joffm.
The following user(s) said Thank You: tpartner, DerBibber17
The topic has been locked.