Welcome to the LimeSurvey Community Forum

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

Matrix mit Dropdown-Menü

  • Candlejoe
  • Candlejoe's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 9 months ago #202386 by Candlejoe
Matrix mit Dropdown-Menü was created by Candlejoe
Hallo zusammen,

für eine Umfrage würde ich gerne eine Frage mit dem Fragetyp Matrix erstellen, bei welcher jede Zelle der Matrix über ein Dropdown-Menü mit vorgegebenen Antworten verfügt. Ich möchte kein Dropdown-Menü mit Zahlen, sondern bei welchem ich von mir vorgefertigte textliche Antworten einfügen kann.

Ist dies in limesurvey möglich?
The topic has been locked.
More
3 years 9 months ago #202389 by jayat
Replied by jayat on topic Matrix mit Dropdown-Menü
Hallo,
man kann bei der Matrix unter Anzeige -> Nutze Listenauswahl-Präsentation einstellen das sollte die gesuchte Funktion sein.
manual.limesurvey.org/Question_types/de#Dual_Matrix
Geht auch bei normaler Matrix

LG Jan
The topic has been locked.
  • Candlejoe
  • Candlejoe's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 9 months ago #202390 by Candlejoe
Replied by Candlejoe on topic Matrix mit Dropdown-Menü
Vielen Dank für deine Antwort.
Genauso, hatte ich mir das vorgestellt.
Ich habe nur vergessen zu erwähnen, dass ich mehr als zwei Kategorien als Abfrage habe. Die Dual-Matrix lässt mich ja nur zwei Kategorien erstellen.
Gibt es da eine Möglichkeit die Dropdown-Funktion zu nutzen und mehrere Kategorien zu erstellen (4 oder 5)?
The topic has been locked.
More
3 years 9 months ago #202391 by jayat
Replied by jayat on topic Matrix mit Dropdown-Menü
Ja das sollte gehen habe ich aber selber noch nicht gemacht. Wobei es nur über javascript geht und nicht direkt über die fragenerstellung
Mal ein Link aus dem Forum
forums.limesurvey.org/forum/can-i-do-thi...rs-in-dropdown-boxes
The following user(s) said Thank You: Candlejoe
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 9 months ago - 3 years 9 months ago #202392 by Joffm
Replied by Joffm on topic Matrix mit Dropdown-Menü
Hallo,

Da Du uns leider nicht gesagt hast, mit welcher Version Du arbeitest, hier ein Beispiel, dass auf jeden Fall in 3.x. funktioniert.

Es handelt sich um eine Matrix(Texte)
Zunächst das script:
Code:
<script type="text/javascript" charset="utf-8">
  $(document).on('ready pjax:scriptcomplete',function(){
    var thisQuestion = $('#question{QID}');
 
    // Insert selects
    $('.answer-item.answer_cell_X001', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
  <option value="">select...</option>\
  <option value="1">very poor</option>\
  <option value="2">somewhat poor</option>\
  <option value="3">neither/nor</option>\
  <option value="4">good</option>\
  <option value="5">very good</option>\
</select>');     
$('.answer-item.answer_cell_X002', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
  <option value="">select...</option>\
  <option value="1">high</option>\
  <option value="2">mid</option>\
  <option value="3">low</option>\
</select>'); 
$('.answer-item.answer_cell_X003', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
  <option value="">select...</option>\
  <option value="1">very satisfied</option>\
  <option value="2">somewhat satisfied</option>\
  <option value="3">neither/nor</option>\
  <option value="4">somewhat unsatisfied</option>\
  <option value="5">very unsatisfied</option>\
</select>'); 
 
    // Listeners
    $('.inserted-select', thisQuestion).on('change', function(i) {
      if($(this).val() != '') {
        $(this).closest('.answer-item').find('input:text').val($.trim($('option:selected', this).text())).trigger('change');
      }
      else {
        $(this).closest('.answer-item').find('input:text').val('').trigger('change');
      }
    });
 
    // Returning to page
    $('.with-select input:text', thisQuestion).each(function(i) {
      var thisCell = $(this).closest('.answer-item');
      var inputText = $.trim($(this).val());
      var selectval = $('select.inserted-select option', thisCell).filter(function () { return $(this).html() == inputText; }).val();
      $('select.inserted-select', thisCell).val(selectval);
    });
 
    // Clean-up styles
    $('select.inserted-select', thisQuestion).css({
      'max-width': '100%'
    });
    $('.with-select input:text', thisQuestion).css({
      'position': 'absolute',
      'left': '-9999em'
    });
  });
</script>

Du siehst, wo Du das script anpassen musst, nämlich in den "Selects".
Wie Du hier siehst (answer_cell_X003) sind die Teilfragen der X-Achse mit "X001", "X002", ... codiert.
Ebenso benutze ich gerne für die Y-Achse entsprechend "Y001", "Y002", ...
Dies erleichtert später die Auswertung, da man keine Zellen "Q1_SQ001_SQ002" hat (was ist Zeile, was ist Spalte?)





Da es sich um eine Matrix(texte) handelt, wirst Du später beim Export auch diese Texte erhalten; da musst Du dann evtl. umcodieren.

Das kannst Du natürlich ausbauen auf mehr Spalten, oder auch nur einige Spalten als Drop-Down, andere als Texteingabe.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 9 months ago by Joffm.
The topic has been locked.
Moderators: Joffm

Lime-years ahead

Online-surveys for every purse and purpose