- Posts: 55
- Thank you received: 3
Ask the community, share ideas, and connect with other LimeSurvey users!
Please Log in to join the conversation.
<style type="text/css"> .no-question { border-top:0; } .no-question .question-title-container { display:none; } .no-question .question-valid-container { display:none; } .no-question .answer-container { padding-top: 0em; padding-bottom: 0em; } .no-question .question-container { border: none !important; } .no-bottom { border-bottom:0;margin-bottom:0; } .no-bottom .answer-container { padding-bottom: 0em; } </style>
Please Log in to join the conversation.
Wenn es keine Datenbankspalte gibt, kann es nicht funktionieren.There are no DB colun for other except the inpyt:text : intended behaviour
Please Log in to join the conversation.
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ function shuffleArray(array) { for (var i = array.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); var temp = array[i]; array[i] = array[j]; array[j] = temp; } return array; } //Identify this question var thisQuestion = $('#question{QID}'); var thisAnswerList = $('tr.answers-list:eq(0)', thisQuestion).parent(); // Special codes appear after var afterCode=11; // Fill the array with "normal" codes var array1=[1,2,3,4,5,6,7,8,9,10,11]; // Fill the array with "special" codes var array2=[12]; shuffleArray(array1); array2=array2.concat(array1.slice(afterCode)); array1=array1.slice(0,afterCode); shuffleArray(array2); array1=array1.concat(array2); alert(array1) // Loop through the answer codes $.each(array1, function(i, val) { // Move the answer item $(thisAnswerList).append($('tr.answers-list[id$="X{QID}'+val+'"]', thisQuestion)); }); }); </script>
Please Log in to join the conversation.
<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>
Please Log in to join the conversation.
Please Log in to join the conversation.