Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

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

Answers random order - partial randomization & keeping distinct answers fixed 7 Monate 1 Woche her #99873

  • t6nnp6nn
  • t6nnp6nns Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 12
  • Karma: 0
I would need to randomize part of the answers and keep some answers at a fixed position.

A typical example - a simple radio question that needs most of the answers randomized, but would need to have a "do not know" fixed at the bottom.

Any ideas how to do that?

I am currently considering renaming "no answer" to "don't know" in the translation.
Alternatively I could have some script rewriting the answers sortorder value on each pageload. Probably some security issues here going directly to edit databases.
Any ways to reorder distinct answers by javascript on display?

I am using multiple versions (eg. 1.92+ and the 2.00)
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Answers random order - partial randomization & keeping distinct answers fixed 7 Monate 1 Woche her #99877

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 3844
  • Dank erhalten: 690
  • Karma: 330
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.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Answers random order - partial randomization & keeping distinct answers fixed 7 Monate 1 Woche her #99883

  • t6nnp6nn
  • t6nnp6nns Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 12
  • Karma: 0
exactly what I was looking for.
excellent, thanks!

I did google for some time to find that but without luck. Thanks again.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Answers random order - partial randomization & keeping distinct answers fixed 7 Monate 1 Woche her #99887

  • t6nnp6nn
  • t6nnp6nns Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 12
  • Karma: 0
have some problems implementing.

I got the "Partially Randomized Answers - Multiple Options & List (radio) questions" working
didn't work on my custom old template, but worked on default

but I can not get the "Partially Randomized Answers - Multiple Options & List (radio) questions - ENHANCED" version working (the one with multiple fixed items).

working with 1.92 build 10859.

Could anybody show a working set-up for the enhanced version??
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Answers random order - partial randomization & keeping distinct answers fixed 7 Monate 1 Woche her #99908

  • t6nnp6nn
  • t6nnp6nns Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 12
  • Karma: 0
found the problem

with the enhanced versiosn you should not set the random_order attribute to 1

The randomization is done with javascript. I set the random_order to 0 and it works in all versions i have now.

so as far as I understand there is a misleading manual - this should not be done with the enhanced version:

"Set the random_order question attribute to 1."
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Answers random order - partial randomization & keeping distinct answers fixed 3 Monate 1 Woche her #103531

  • LloydW
  • LloydWs Avatar
  • OFFLINE
  • Gold Donor
  • Beiträge: 32
  • Dank erhalten: 1
  • Karma: 0
Similar sort of question but for an array.

I want to randomise all the subquestions, but I want to hold the last one (which is different from the rest) at the end of the list (but not an exclusive answer like 'none of the above').

Haven't been able to get most of the solutions I've found on-line to work. The question example is attached & using Limesurvey 2.05.

Regards, Lloyd.
Anhang:
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Answers random order - partial randomization & keeping distinct answers fixed 3 Monate 1 Woche her #103551

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 3844
  • Dank erhalten: 690
  • Karma: 330
Lloyd, since your sub-question codes all start with an alpha character (as they should) and are sequential, we can detect the highest code (alphabetically) and move that sub-question to the end.

Add the following to the array question source:

<script type="text/javascript" charset="utf-8">	
 
	$(document).ready(function() {
 
		// Identify this question ID
		var qID = {QID};
 
		// Build an array of subquestion codes
		var sqCodeArr = new Array();
		$('#question'+qID+' table.question tbody tr').each(function(i) {
 
			var sqCode = $(this).attr('id').split('X'+qID+'')[1];
			sqCodeArr.push(sqCode);
		});
 
		// Find the highest code (alphabetically) 
		sqCodeArr.sort(); 
		var highCode = sqCodeArr[sqCodeArr.length-1];
 
		// Now, move that subquestion to the bottom 
		$('#question'+qID+' table.question tbody').append($('#question'+qID+' tr[id$="X'+qID+highCode+'"]'));
	});
 
</script>


.
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.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: LloydW

Answers random order - partial randomization & keeping distinct answers fixed 3 Monate 1 Woche her #103571

  • LloydW
  • LloydWs Avatar
  • OFFLINE
  • Gold Donor
  • Beiträge: 32
  • Dank erhalten: 1
  • Karma: 0
A super solution and well coded and explained - thanks Tony it works a charm. :cheer:

Many thanks.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.144 Sekunden
Donation Image