Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Random assignment to conditions

Random assignment to conditions 7 months 2 days ago #104175

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4134
  • Thank you received: 765
  • Karma: 347
Yes, that's why I used JavaScript.

.
Cheers,
Tony Partner

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

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Random assignment to conditions 4 months 3 weeks ago #107099

  • zboy
  • zboy's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 9
  • Karma: 0
Hi guys,

I would like to use the code posted on the first page but I can't get it working. Do I need to change anything in it like the qID or something like that?

Thanks.
The administrator has disabled public write access.

Random assignment to conditions 2 months 3 weeks ago #109707

  • fiona92
  • fiona92's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 2
  • Karma: 0
tpartner wrote:
Well, you can use the {SUBMITID} variable (which is available AFTER the first page submission) and the JavaScript modulus operator to load a hidden short-text question with sequential numbers between 1 and 4.

Note though, that the sequential number will increment with every respondent, even those who don't complete the survey.

Add this script to the source of a short-text question:
<script type="text/javascript" charset="utf-8">	
 
	$(document).ready(function() { 
 
		var submitID = {SAVEDID};
 
 		// Hide this question
		$('#question'+qID).hide();
 
		// Find sequential number between 1 and 4 based on the SUBMITID
		var conditionNumber = (submitID % 4) + 1;
 
 		// Load the hidden question
		$('#question'+qID+' input.text').val(conditionNumber);
	});
</script>

.

I don't know where to fill in this script?
After the first page submission.... So after the first question is filled in, by the second question fill in this script? Of by the first question, after the page with welcome and intructions? And how do i make the different questionaires for the three groups?
The administrator has disabled public write access.

Random assignment to conditions 2 months 3 weeks ago #109735

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4134
  • Thank you received: 765
  • Karma: 347
After the first page submission.... So after the first question is filled in, by the second question fill in this script?
Place the script in the source of a short-text question on a page AFTER the first QUESTION PAGE has been submitted.



And how do i make the different questionaires for the three groups?
See conditions or relevance - manual.limesurvey.org/Setting_conditions.


.
Cheers,
Tony Partner

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

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Last Edit: 2 months 3 weeks ago by tpartner.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.116 seconds
Donation Image