View Issue Details

This bug affects 1 person(s).
 0
IDProjectCategoryView StatusLast Update
20200Bug reports_ Unknownpublic2025-08-01 17:00
ReporterAndrea01 Assigned To 
PrioritynoneSeveritypartial_block 
Status newResolutionopen 
Product Version6.4.x 
Summary20200: In a multiple-choice question with random order and an exclusive option, the exclusive option is not placed at the end.
Description

It only works with Joffm's JavaScript 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 = 1;

    // 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>

Steps To Reproduce

Joffm did reproduce the bug

TagsNo tags attached.
Bug heat0
Complete LimeSurvey version number (& build)LimeSurvey Community Edition Version 6.15.5+250724
I will donate to the project if issue is resolvedNo
Browserfirefox, edge
Database type & versionmysqul ??
Server OS (if known)
Webserver software & version (if known)
PHP VersionPHP Version 7.4.33

Users monitoring this issue

There are no users monitoring this issue.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2025-08-01 17:00 Andrea01 New Issue