Partial Randomization Radio List - Beginner

Mehr
3 Wochen 7 Stunden her #173425 von haroldrio
haroldrio erstellte das Thema Partial Randomization Radio List - Beginner
Hi there.
I would like to ask for your help.
I am using limesurvey 3.xx

This is the code.


<script type="text/javascript" charset="utf-8">

$(document).on('ready pjax:scriptcomplete',function(){

// The number of answers to be fixed at the end of the list
var fixedAnswers = 2;

// Set this to "true" if you want "Other" to be fixed in the last position
var otherFixed = false;

// Identify this question
var qID = {QID};

// Find the number of answers
var ansCount = $('#question'+qID+' .answer-item').length;
if($('#question'+qID+' input[type="text"]').length > 0) {
ansCount = ansCount -1
}
console.log(ansCount);

// Place the last n answers created at the end of the list
var fixedIndex = fixedAnswers - 1;
for (var i=0; i<fixedAnswers; i++) {
var answer = $('input[id^="answer"][id$="X'+qID+(ansCount-fixedIndex)+'"]');
var answerItem = $(answer).closest('.answer-item');
var answersList = $(answer).closest('ul');
$(answersList).append(answerItem);
fixedIndex--;
}

// Handle "Other"
if(otherFixed == true && $('#question'+qID+' input[type="text"]').length > 0) {
var otherAnswer = $('#question'+qID+' input[type="text"]');
var otherAnswerItem = $(otherAnswer ).closest('.answer-item');
var otherAnswersList = $(otherAnswer ).closest('ul');
$(otherAnswersList).append(otherAnswerItem);
}
});
</script>


How can I modify this code.

I have turned off my html filtering already.
answer code are in numerical order too.


// Set this to "true" if you want "Other" to be fixed in the last position
var otherFixed = false;

// Identify this question
var qID = {QID}

changed the false to true
{QID} changed to {1333}

is that correct? how about the rest?
sorry I am a total newb to coding.

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
3 Wochen 7 Stunden her #173426 von haroldrio
haroldrio antwortete auf das Thema: Partial Randomization Radio List - Beginner
I would appreciate if anyone can highlight those codes that needs to be replaced and a sample for each variable.

Thank you so much.

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
3 Wochen 6 Stunden her #173427 von tpartner
tpartner antwortete auf das Thema: Partial Randomization Radio List - Beginner
The script given in the workaround page works as expected in LS 3.14.6.

Sample survey attached:

Dateianhang:

Dateiname: limesurvey...9-04.lss
Dateigröße:24 KB

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Anhang:
Folgende Benutzer bedankten sich: haroldrio

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
3 Wochen 5 Stunden her #173434 von haroldrio
haroldrio antwortete auf das Thema: Partial Randomization Radio List - Beginner
Oh My. So this is the only 3 variables that needs to be changed.
Didn't know the right QID.

Thank you so much.
Now my survey is looking cool! B) B) B) B)

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
3 Wochen 5 Stunden her #173435 von haroldrio
haroldrio antwortete auf das Thema: Partial Randomization Radio List - Beginner
Anhang:

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
3 Wochen 4 Stunden her #173445 von tpartner
tpartner antwortete auf das Thema: Partial Randomization Radio List - Beginner
You do not need to modify {QID}, that will automatically be replaced with the question ID.

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

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

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
captcha