Welcome, Guest
Username: Password: Remember me

TOPIC: Answers random order - partial randomization & keeping distinct answers fixed

Answers random order - partial randomization & keeping distinct answers fixed 1 year 8 months ago #109758

  • dknvs
  • dknvs's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 12
  • Karma: 0
YAY! IT WORKS! THANK YOU SO MUCH! :woohoo:
The administrator has disabled public write access.

Answers random order - partial randomization & keeping distinct answers fixed 1 month 1 week ago #129711

help me about ,Array questions to be randomized while always keeping 3 sub-question at the end
The administrator has disabled public write access.

Answers random order - partial randomization & keeping distinct answers fixed 1 month 1 week ago #129712

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5421
  • Thank you received: 1156
  • Karma: 480
If, for example, the sub-question codes of the last 3 items are 97, 98 and 99, you can insert a script like this:

<script type="text/javascript" charset="utf-8">		
	$(document).ready(function(){ 
 
		// Move sub-question codes 97, 98, 99 to the end of the array
		$('#question{QID} table.subquestions-list tbody').append($('#question{QID} table.subquestions-list tr[id$="X{QID}97"]'))
		.append($('#question{QID} table.subquestions-list tr[id$="X{QID}98"]'))
		.append($('#question{QID} table.subquestions-list tr[id$="X{QID}99"]'));
 
		// Fix up array row background colours
		$('#question{QID} table.subquestions-list tbody > tr').each(function(i){
			$(this).removeClass('array1 array2').addClass('array'+(2-(i%2)));
		});
    });
</script>

Sample survey attached:

File Attachment:

File Name: limesurvey...9847.lss
File Size:19 KB
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.
The following user(s) said Thank You: delarammahdaviii

Answers random order - partial randomization & keeping distinct answers fixed 1 month 1 week ago #129713

Thanks Tony :)
The administrator has disabled public write access.

Answers random order - partial randomization & keeping distinct answers fixed 1 week 1 day ago #130977

  • flannery
  • flannery's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 1
  • Karma: 0
Attached is an updated version for 2.50+. This will keep subquestions 12 and 13 at the bottom of the list for a multiple choice question using the newspaper theme.
<script type="text/javascript" charset="utf-8">		
	$(document).ready(function(){ 
 
		// Move sub-question codes 12, 13 to the end of the array
		$('#question{QID} .subquestions-list ').append($('#question{QID} .subquestions-list div[id$="X{QID}12"]').parent() ).append($('#question{QID} .subquestions-list div[id$="X{QID}13"]').parent() );
 
    });
</script>
Last Edit: 1 week 1 day ago by flannery.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.547 seconds