Multiple question types in array

Mehr
1 Jahr 11 Monate her #129343 von Stan
Stan erstellte das Thema Multiple question types in array
Hi all,

i would like to let some questions appearing in an array. The workaround in the Manual is very good but the Javascript-code doesn't set it up in the way i want it. Then the code is taking in all the next following questions in the change, while i just want to put only 2 or 3 questions in the same array. Is there a way to modify the code, so that it would take only a specific number of questions and not influence the following ones? Thanks.

Using LS Version 2.06+ Build 151018

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
1 Jahr 11 Monate her #129345 von holch
holch antwortete auf das Thema: Multiple question types in array
From what I read in the explanation of the workaround you can adapt the columns and lines so that it takes only certain questions on the page.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds
Folgende Benutzer bedankten sich: Stan

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
1 Jahr 11 Monate her - 1 Jahr 11 Monate her #129356 von Stan
Stan antwortete auf das Thema: Multiple question types in array
Thanks holch for reply.

I tried to manipulate the code without success (despite of a quick Java Tutorial). I certainly need a hint on this.
Here is a LINK to the survey i'm working on.
For example, i just want the two first questions to be displayed in an array. And the following others normally.
Letzte Änderung: 1 Jahr 11 Monate her von Stan. Begründung: Complete information

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
1 Jahr 11 Monate her #129362 von holch
holch antwortete auf das Thema: Multiple question types in array
Off-topic: Seeing your example, I am not even sure why you want these two questions in an array. They don't really have anything to do one with the other (e.g. the same subquestion per line). These are actually two separate questions and I personally would treat and display them as such.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
1 Jahr 11 Monate her #129374 von tpartner
tpartner antwortete auf das Thema: Multiple question types in array
It seems to me that you have called the sideBySide() function with 4 rows and 4 columns, so it will attempt to manipulate 16 questions.

If you only want 2 questions in a single row, this:
sideBySide(4, 4, 1);

Should be something like this:
sideBySide(1, 2, 1);

Having said that, if only a couple of questions are to be manipulated, you may be better off just aligning them side-by-side with CSS.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Folgende Benutzer bedankten sich: Stan

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
1 Jahr 11 Monate her #129389 von Stan
Stan antwortete auf das Thema: Multiple question types in array
Hi holch,

don't worry :-) I just wanted to show how the code is displaying the questions (without paying attention to the logic).

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
1 Jahr 11 Monate her #129390 von Stan
Stan antwortete auf das Thema: Multiple question types in array
Thank you tpartner,

i applied everything as you recommended and it works. Here a snapshot.
Anhang:

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
1 Jahr 11 Monate her - 1 Jahr 11 Monate her #129391 von Stan
Stan antwortete auf das Thema: Multiple question types in array
I do have another question.
The next following question is looking like this - And i want questions 1 and 2 to look like above in an array.


So i simply inserted the whole code in the question "1" (it's actually the 7th question in my survey:
sideBySide(1, 2, 7);
and the result is this:


The questions "1" and "2" are joining the array above. While i want them to stay at their place. In other words, i would like to have the array above two times (or more when necessary) in the survey at different places. Because these questions will be asked very often.
How can we make that happen?
Anhang:
Letzte Änderung: 1 Jahr 11 Monate her von Stan.

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
1 Jahr 11 Monate her - 1 Jahr 11 Monate her #129410 von tpartner
tpartner antwortete auf das Thema: Multiple question types in array
That workaround was not intended to be used more than once on a page and, if all you want to do is align various sets of two questions side-by-side, I think it may be overkill anyway.

Can you attach a small sample survey containing only that group?

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Letzte Änderung: 1 Jahr 11 Monate her von tpartner.
Folgende Benutzer bedankten sich: Stan

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
1 Jahr 11 Monate her #129461 von Stan
Stan antwortete auf das Thema: Multiple question types in array
Thanks tpartner,

HERE is a sample survey containing only the group but without the workaround.
HERE the same sample with the workaround like before.

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
1 Jahr 11 Monate her #129464 von holch
holch antwortete auf das Thema: Multiple question types in array
To help you Tpartner will probalby need that you export a sample survey (containing only the part in question). He can't work on your survey, and it is a bit much to ask of him to rebuild the survey to help you. ;-)

Help him/us to help you.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds
Folgende Benutzer bedankten sich: tpartner

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
1 Jahr 10 Monate her #129516 von tpartner
tpartner antwortete auf das Thema: Multiple question types in array
Yes, please attach an EXPORT of a small sample survey containing only that group, not a link to an existing survey?

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

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
1 Jahr 10 Monate her #129560 von Stan
Stan antwortete auf das Thema: Multiple question types in array
Sorry holch and tpartner,

i didn't understood it that way. Here is an export of the sample survey. Thanks a lot.

Dateianhang:

Dateiname: limesurvey...7256.lss
Dateigröße:48 KB
Anhang:

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
1 Jahr 10 Monate her - 1 Jahr 10 Monate her #129574 von tpartner
tpartner antwortete auf das Thema: Multiple question types in array
Add this script to the first question of each pair you want to display side-by-side. Note that some of the selectors and styles in this script are specific to the default template so may need to be changed for other templates.

<script type="text/javascript" charset="utf-8">		
	$(document).ready(function() {	
 
		// Identify the questions
		var thisQuestion = $('#question{QID}');
		var nextQuestion = $(thisQuestion).nextAll('div[id^="question"]:eq(0)');
		var theseQuestions = $(thisQuestion).add(nextQuestion);
 
		// Place the questions side-by side
		$(theseQuestions).wrapAll('<div style="width:75%; margin: 0 auto" />');
		theseQuestions.css({
			'float': 'left',
			'width': '50%'
		});
		$('> table', theseQuestions).css({
			'width': '100%'
		});
 
		// Some styling for the textareas
		$('textarea', theseQuestions).removeAttr('cols').css({
			'margin-left': '0',
			'margin-right': '0',
			'width': '100%'
		});
 
		// Equalize heights
		if($(thisQuestion).is(':hidden')) { 
			$(theseQuestions).css({
				'position': 'absolute',
				'left': '-9999em'
			}).show();
			equalizeHeights();
			$(theseQuestions).css({
				'position': 'relative',
				'left': 'auto'
			}).hide();
		}
		else {
			equalizeHeights();
		}
 
		function equalizeHeights() {
			var questionTextHeight = 0;
			$('td.questiontext', theseQuestions).each(function(i) {
				if($(this).height() > questionTextHeight) {
					questionTextHeight = $(this).height()
				}
				$('td.questiontext', theseQuestions).height(questionTextHeight);
			});
			var answerHeight = 0;
			$('td.answer', theseQuestions).each(function(i) {
				if($(this).height() > answerHeight) {
					answerHeight = $(this).height()
				}
				$('td.answer', theseQuestions).height(answerHeight);
			});
			var helpHeight = 0;
			$('td.survey-question-help', theseQuestions).each(function(i) {
				if($(this).height() > helpHeight) {
					helpHeight = $(this).height()
				}
				$('td.survey-question-help', theseQuestions).height(helpHeight);
			});
		}		
    });
</script>

Here is an abbreviated version of your survey with the script in the source of questions 2 and 5:

Dateianhang:

Dateiname: limesurvey...7256.lss
Dateigröße:24 KB

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Anhang:
Letzte Änderung: 1 Jahr 10 Monate her von tpartner.
Folgende Benutzer bedankten sich: Stan

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
1 Jahr 10 Monate her #129593 von Stan
Stan antwortete auf das Thema: Multiple question types in array
Waouh! Thanks a lot, tpartner.

Bitte Anmelden um an der Konversation teilzunehmen.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey
captcha