Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

TOPIC: random order of answer categories, except for...

random order of answer categories, except for... 4 years 2 months ago #86690

  • arielmosto
  • arielmosto's Avatar
  • Offline
  • Junior Lime
  • Posts: 34
  • Karma: 0
Dear Tony:

I need the same for the Ranking question type.

Is that possible?
I tried this same code, but does not work.

Thank you very much ! Regards ! Ariel
The administrator has disabled public write access.

random order of answer categories, except for... 4 years 2 months ago #86691

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6574
  • Thank you received: 1477
  • Karma: 579
Ariel, this thread is getting a little convoluted. Do you want to randomize all choices except except the last one or all except the first one.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The administrator has disabled public write access.

random order of answer categories, except for... 4 years 2 months ago #86692

  • arielmosto
  • arielmosto's Avatar
  • Offline
  • Junior Lime
  • Posts: 34
  • Karma: 0
Dear Tony, thanks.

I need to randomize all choices except the last one.

Regards !
The administrator has disabled public write access.

random order of answer categories, except for... 4 years 2 months ago #86697

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6574
  • Thank you received: 1477
  • Karma: 579
I think the easiest way to achieve that would be to...

1) Append the answer code of the last item with "_l"


2) In the ranking question, set "Random answer order" to "Yes"


3) Add the following script to the source of the ranking question. Replace "QQ" with the ranking question ID.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		var qID = QQ;
 
		$('#question'+qID+' .rank.label select').append($('#question'+qID+' .rank.label option[value$="_l"]'));
	});
 
</script>
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The administrator has disabled public write access.
Time to create page: 0.198 seconds
Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form