Welcome to the LimeSurvey Community Forum

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

Hinzufügen einer Dritten Spalte zu einer Dual Matrix

  • andreas.freymann
  • andreas.freymann's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 2 months ago - 2 years 2 months ago #236352 by andreas.freymann
Bitte helfen Sie uns, Ihnen zu helfen und füllen Sie folgende Felder aus:
Ihre LimeSurvey-Version: Version 5.4.0+220913
Eigener Server oder LimeSurvey-Cloud:
Genutzte Designvorlage:
==================
[Schreiben Sie hier Ihre Nachricht]

Guten Tag,
ich versuche leider ohne wenig Erfolg, dass ich mit JavaScript eine Dritte Spalte zu einer Dual Matrix-Umfrage hinzufüge. Es wird mir zwar eine Dritte Spalte angezeigt, aber ohne Inhalt: Ohne Textfeld. Zudem ist mir auch nicht klar, wie ich die Überschrift für die Spalte setzen kann.

Bräuchte ein paar Tipps, komme hier nicht weiter. Vorab schonmal danke.

Andreas

Hier mein Skript:

<script type="text/javascript" charset="utf-8">
 
    $(document).on('ready pjax:scriptcomplete',function(){
 
        // Identify the questions
        var qArrayID = {QID};
        var qArray = $('#question'+qArrayID);
        var qMultiText = qArray.nextAll('.multiple-short-txt:eq(0)');
 
        // Add some classes
        qArray.addClass('array-with-uploads-question');
 
      // Hide the multi-short-text question
        $(qMultiText).hide();
 
        $('table.questions-list col:not(.col-answers)', qArray).css('width', 'auto');
 
                $('table.questions-list thead tr', qArray).append('<th class="answer-text inserted-column-label" /></th>');
 
        $('tr.answers-list', qArray).each(function(i) {
            $(this).append('<td class="answer-item text-item">\
                            </td>\
                            ');
        });
 
        // Load the column label for the text inputs
        $('.inserted-column-label:eq(0)', qArray).text($('.ls-label-question', qMultiText).text());
        $('.text-item', qArray).prepend('<label class="ls-label-xs-visibility">'+$('.ls-label-question', qMultiText).text()+'</label>')
 
        // Loop through the multi-short-text sub-questions
        $('li.answer-item', qMultiText).each(function(i) {
            // Move the text inputs into the array
            $('input[type="text"]', this).appendTo($('tr.answers-list:eq('+i+') .text-item', qArray));
        });
 
    });
</script>

 
Last edit: 2 years 2 months ago by andreas.freymann.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 2 months ago #236376 by Joffm
Hallo,
Du kannst das Beispiel aus Kapitel 4.1. aus meinem "Tutorial 1: Matrizen" nehmen.
Einfach auf "Dual Matrix" ändern.
 

Zusätlich kannst Du auch die Splatenbreiten verändern, Kapitel 2.
 

Joffm

 

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

Please Log in to join the conversation.

Moderators: holchJoffmtpartner

Lime-years ahead

Online-surveys for every purse and purpose