Small solution to randomize responses

2 Monate 2 Wochen her - 2 Monate 2 Wochen her #183033 von Marksom
OfflineSurveys does not yet allow random responses.

But as I needed to use it, I created a function to resolve temporarily, and that worked well for me. So I'm sharing it to anyone who needs it.

Add the following function to the question source code:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
            qid : '{QID}', //qid of question
            array : false, //True for array subquestions or False for radio, checkbox.
            excluir : ['other'] //exclude randomization option

And add the following function to your template.js
function randomItems(data){
	var el = $('#question'+data.qid);
	var pr = data.array==true?'.answers-list':'.answer-item';
	var o = [];
		var id = $(this).attr('id').split(data.qid).pop();
	for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);

So that's it, I hope this code helps somebody.
Letzte Änderung: 2 Monate 2 Wochen her von Marksom.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

LimeSurvey Partners

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey