Check out the LimeSurvey source code on GitHub!

Creating Multiple Treatments in a Single Survey?

More
5 years 9 months ago #60595 by dgc11
I'm new to limesurvey and previously used SurveyMonkey to create surveys. In SurveyMonkey, if I wanted to survey people on six different treatments, I'd create six different surveys...all of which were the same until I got to the one question that changed.

For example, person A, B, C, and D are all working on a survey. Person A needs to receive the survey where question 8 has graphic 1 with questions, Person B needs to receive the survey where question 8 has graphic 2 with questions, etc.

I've read up on the wiki about setting conditions, but I really don't think that setting hide/show or jumping conditions is what I need. Because all the questions before this question are the same...for everyone. And no matter what the person answers to the previous question, they still need to advance to this graphic question...it's just that I need to randomize the graphic questions so each survey taker only sees one graphic question..and not all four.

I guess what I need to know is is it possible to create just one survey in limesurvey and test 6 different treatments in that one survey? (I hope this makes sense)

Please Log in to join the conversation.

More
5 years 9 months ago #60687 by tpartner
You can load a random number into a hidden short-text question with JavaScript and then use conditions to display the appropriate graphic questions depending on the value of the hidden question.

The script to hide and load the hidden question would be something like this, where "QQ" is the short-text question ID.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		var qHidden = QQ;
		var maxNum = 6;
 
		// Hide the hidden question
		$('#question'+qHidden+'').hide();
 
		if ($('#question'+qHidden+' input.text').val() == '') {
 
			// Find a random number between 1 and "maxNum"
			randNum = Math.floor(Math.random()*maxNum + 1);
 
			// Load the random number into the hidden question
			$('#question'+qHidden+' input.text').val(randNum);
		}
 
	});
 
</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
5 years 9 months ago - 5 years 9 months ago #60864 by Zappes
Hello TPartner! I had last time the same problem. Your script is not working for me ( I am using limesurves 1.90). The script is fine but if I want to use conditions it doesnt show me anything... Do I have to write instead of QQ the Question ID? In which form? I think it does not load the answer of the randomization in the answer text...
Last Edit: 5 years 9 months ago by Zappes. Reason: exakter

Please Log in to join the conversation.

More
5 years 9 months ago #60866 by lovepade
Are you using tokens? I'd create e.g. a "type" token for each respondent, and then make question 8 conditional on that? I think this is possible?

Please Log in to join the conversation.

More
5 years 9 months ago #60876 by tpartner

Do I have to write instead of QQ the Question ID?

Yes. See the image below.


You can check that the hidden question is being loaded by commenting out the hide() function.

Change:
$('#question'+qHidden+'').hide();

To:
//$('#question'+qHidden+'').hide();

Cheers,
Tony Partner

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

Please Log in to join the conversation.

More
5 years 6 months ago #64761 by MaLu
Hi TPartner,

basically, I have the same isue as described above. However, after inserting the script (copy/paste), changing QQ and unhiding the question, it won't appear prefilled with a random value.
I am using Version 1.91 Build 10089 if that matter...

Can you help me on this?

Thank,
Marie

Please Log in to join the conversation.

More
5 years 6 months ago #64765 by tpartner
Are there any JavaScript errors in the console? Can you activate a sample survey?

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
5 years 6 months ago #64801 by MaLu
Hi Tony,
here's an activates sample survey: www.panel.statista.com/befragung/index.p...37&newtest=Y&lang=de

I set conditions on questions 2, 3 and 4 to appear when Q1 is 1,2 respective 3.

Thank you!
Marie

Please Log in to join the conversation.

More
5 years 6 months ago #64806 by tpartner
You have a syntax error.

Remove this from the second last line of the script:
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
5 years 6 months ago #64872 by MaLu
Oh, that's it...

Thank you!

Please Log in to join the conversation.

More
5 years 6 months ago #64873 by MaLu
However, the subsequent questions that are linked to either 1, 2 or 3 in Q1 won't appear... (I set conditions that e.g. Q2 appears when the absolute term in Q1 is 1).

Marie

Please Log in to join the conversation.

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