Check out the LimeSurvey source code on GitHub!

MaxDiff question type alignment

More
4 years 9 months ago #79538 by ricardo01
I designed the MaxDiff question using this workaround: docs.limesurvey.org/Workarounds%3A+Quest...axDiff_question_type

When I run the survey, the question in the first section are misaligned, one side being wider than the other:




However, on the second section, they are aligned





Has anybody else experienced the same problem? How can I get the questions to be aligned in all sections?

rg
Attachments:

Please Log in to join the conversation.

More
4 years 9 months ago #79546 by Mazi
Can you please post a link to an activated sample survey?


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
4 years 9 months ago #79565 by ricardo01

Please Log in to join the conversation.

More
4 years 9 months ago #79569 by Mazi
The default template uses different styles for odd and even pages, maybe that explains the behavior?

1. Try using a different template, can you reproduce the problem?

2. What happens if you show the survey in all in one mode?


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
4 years 9 months ago #79574 by ricardo01
1. The problem is reproduced on each template in group by group mode.

2. The problem seems to be solved when I use all in one mode (well... with some of the templates). I guess I could go this way. However, I prefer giving questions to participants one group at a time.

Thanks for the suggestion, though.

Please Log in to join the conversation.

More
4 years 9 months ago #79594 by Mazi
Quite a weird error, but I still can't say what causes this problem. Might be related to the workaround code.


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
4 years 9 months ago #79642 by tpartner
ricardo, can you attach a copy of your survey and template?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
4 years 9 months ago #79662 by ricardo01
Tony,
See attached. I've attached 2 templates. One of them is the one I'd like to use for the survey, and the other one is the default template in Version 1.92+ Build 120425, which also reproduces the problem

cheers,

ricardo

File Attachment:

File Name: default.zip
File Size:42 KB


File Attachment:

File Name: limesurvey...4591.lss
File Size:112 KB


File Attachment:

File Name: nciia2template.zip
File Size:192 KB
Attachments:

Please Log in to join the conversation.

More
4 years 9 months ago #79672 by tpartner
Ah, there's a bug in my code when using for multiple questions on a page.

Additionally, you only need to place the script in one question per page.

So you can place this in one question (where Q1, Q2, Q3, Q4 are the question IDs):
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		maxDiff(Q1, 'You cannot select this answer twice.');
		maxDiff(Q2, 'You cannot select this answer twice.');
		maxDiff(Q3, 'You cannot select this answer twice.');
		maxDiff(Q4, 'You cannot select this answer twice.');
 
		function maxDiff(qID, msg) {
			// Move the cells around
			$('#question'+qID+' table.question col:eq(1)').prependTo('#question'+qID+' colgroup.col-responses');
			$('#question'+qID+' table.question thead tr:eq(0) th:eq(0)').prependTo('#question'+qID+' table.question thead tr:eq(0)');
			$('#question'+qID+' table.question tbody tr').each(function(i){
				$('td:eq(0)', this).prependTo(this);
			});
 
			// Style stuff
			$('#question'+qID+' table.question col.odd').css({ 'background-color':'transparent' });
			$('#question'+qID+' table.question tbody th').css({ 'text-align':'center' });
			$('#question'+qID+' table.question tbody tr:even td, #question'+qID+' table.question tbody tr:even th').css({ 'background-color':'#F1F1F1' });
			$('#question'+qID+' table.question tbody tr:odd td, #question'+qID+' table.question tbody tr:odd th').css({ 'background-color':'#FCFCFC' });
 
			// Prevent clicking twice in the same row
			$('#question'+qID+' input.radio').mousedown(function () {
				var clickRow = $(this).parents('tr:eq(0)');
				if ($('input.radio:checked', clickRow).length > 0) {
					alert (msg);
					return false;
				}
			});
			$('#question'+qID+' table.question tbody td').mousedown(function () {
				var clickRow = $(this).parents('tr:eq(0)');
				if ($('input.radio:checked', clickRow).length > 0) {
					alert (msg);
				return false;
				}
			});
		} 
 
	});
 
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
4 years 9 months ago #79674 by ricardo01
Dear Tony, Thanks for looking into this.

The width of outer columns has been fixed... but now the blocks are aligned to the left (see pic). Does this have to do with the width of the statements in the column in the middle?. Can something be done with your new script so all the blocks are justified, regardless of length of statements?

This is the link to the active survey

nciia.org/surveys/l19/index.php?sid=85459&lang=en

Cheers,

ricardo
[attachment:1]maxdiffalign.png[/attachment]

Please Log in to join the conversation.

More
4 years 9 months ago #79675 by ricardo01
Dear Tony, Thanks for looking into this.

The width of outer columns has been fixed... but now the blocks are aligned to the left (see pic). Does this have to do with the width of the statements in the column in the middle?. Can something be done with your new script so all the blocks are justified, regardless of length of statements?

This is the link to the active survey

nciia.org/surveys/l19/index.php?sid=85459&lang=en

Cheers,

ricardo

Please Log in to join the conversation.

More
4 years 9 months ago #79695 by tpartner
Add the following to the end of template.css:
.array-flexible-column table.question {
    width: 100%;
}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
4 years 9 months ago #79702 by ricardo01
Dear Tony, thank you very much. The survey is looking fantastic. There's one last minor issue...The header in the right column appears over a green background. How can I put that background on the left header?


Attachments:

Please Log in to join the conversation.

More
4 years 9 months ago #79715 by tpartner
1) Remove this line from the script:
$('#question'+qID+' table.question col.odd').css({ 'background-color':'transparent' });

2) Add this to the end of template.css:
.array-flexible-column col.odd, 
.array-flexible-column col.even {
    background-color: #CBEFF2 !important;
}

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: ricardo01

Please Log in to join the conversation.

More
4 years 9 months ago #79751 by ricardo01
Tony...thanks for your help...the survey is looking great.

Cheers

rg

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form