Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Sonstiges Option Klickbar machen ohne Texteingabe (Optionale Texteingabe)

  • BBSR-SR5
  • BBSR-SR5's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 month 4 days ago #258929 by BBSR-SR5
Bitte helfen Sie uns, Ihnen zu helfen und füllen Sie folgende Felder aus:
Ihre LimeSurvey-Version: Version 6.4.12 Eigener Server oder LimeSurvey-Cloud: LimeSurvey Cloud
Genutzte Designvorlage: Eigene auf Grundlage fruity_twentythree - Blueberry
==================

Hallo allerseits,

ich versuche gerade im Limesurvey einzustellen, dass man den Haken bei der "sonstige" Option bei der Mehrfachauswahl setzen kann, ohne dass zwingend ein Text geschrieben wurde. Wie kann ich das einstellen? Ich finde die Option dafür nicht im Fragemenü.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 4 days ago #258933 by Joffm
Hallo,
dazu kann ich eigentlich nichts sagen.
Ich weiß aber, dass dies vor einiger Zeit schon einmal angesprochen wurde.

Meiner Meinung nach steckt die Idee dahinter, dass es nicht sinnvoll ist, "Sonstiges" anzuklicken ohne zu sagen was denn "nun Sache ist".
Davon hat der Interviewende ziemlich wenig.

Wenn Du dies simulieren willst, füge eine "normale" Teilfrage ein, und lasse bei Klick eine Frage vom Typ "kurzer Text" aufploppen, die der Befragte dann ausfüllen kann oder auch nicht.
Kannst Du zum Beispiel mit den css-Klassen "no-bottom" und "no-question" gut integrieren.





Die beiden Klassen
Code:
<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>

Wäre eine Möglichkeit.

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 4 days ago #258936 by Joffm
Da hatte ich also Recht,
hier ist der Thread
[url] forums.limesurvey.org/forum/design-issue...d-in-multiple-choice [/url]

Und da kommt die simple Erklärung von @Denis

There are no DB colun for other except the inpyt:text : intended behaviour

Wenn es keine Datenbankspalte gibt, kann es nicht funktionieren.
Ist immer ein guter Ratschlag:
Umfrage aktivieren, evtl. einige wohl definierte Daten eingeben, Antworttabelle anschauen




Entweder wird ein "Y" eingetragen, und bei "Sonstige" nur der Text.

Joffm

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • BBSR-SR5
  • BBSR-SR5's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 week 2 days ago #260513 by BBSR-SR5
Danke für den Hinweis,

das habe ich jetzt so umgesetzt. Ich habe jetzt nur das Problem, dass ich gerne die Items rotieren möchte und das sonstige Item an seinem (letzten) Platz lassen möchte. Ich hatte gehofft, dass ich dafür einfach den Code aus den Matrix rotationen verwenden könnte:
Code:
<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>
Aber das funktioniert nicht. Während der array1 korrekt erzeugt wird, wird die Anordnung der Items nicht verändert. Ich nehme an, der Loop am Schluss muss dafür verändert werden, aber ich weiß nicht wie :)

Please Log in to join the conversation.

  • BBSR-SR5
  • BBSR-SR5's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 week 2 days ago - 1 week 2 days ago #260515 by BBSR-SR5
Ich habe die Lösung selber gefunden. In dem fall aktiviert man einfach die Zufällig Antwortrotation und ergänzt folgenden Code im Fragefenster:
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 &amp;&amp; $('#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>


Den Code habe ich aus dem manual hier btw: manual.limesurvey.org/Workarounds:_Manip...28radio.29_questions

Edit: Wichtiger Hinweis, der Code funktioniert nur wenn die Antwortoptionen mit Zahlen nummeriert sind.
1,2,3,4,5,6 geht
a,b,c,d,e,f geht nicht!
Last edit: 1 week 2 days ago by BBSR-SR5. Reason: Einschränkung gefunden

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 week 2 days ago #260516 by Joffm
Ich wollte gerade schon Deinen ersten post beantworten.
Das script dort ist ja für etwas anderes gedacht.

Dieses ist ja der Standard; findest Du auch in meinem "Tutorial 2: Mehrfachnennungen,..."

Und gut, dass Du noch einmal darauf aufmerksam gemacht hast, dass die Codes numerisch in aufsteigender Reihenfolge sein müssen.
Ich finde, dieser Hinweis wird im Handbuch leicht überlesen.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

Moderators: Joffm

Lime-years ahead

Online-surveys for every purse and purpose