- Posts: 48
- Thank you received: 2
Ask the community, share ideas, and connect with other LimeSurvey users!
have a question where respondents need to choose one item from a contrasting pair. This is repeated for 8 pairs. Rather than making separate questions in a question group, I want to include all the pairs in one single question using an array function. I am trying to design something similar to the "Choose Between Pairs of Contrasting Leadership Styles" example, but I cannot find the right logic to fit my needs. I am currently conceptualizing how to set up a question with 8 repeated choice sets of contrasting pairs. Thank you in advance. Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ var thisQuestion = $('#question{QID}'); // Move the array labels $('tr.answers-list', thisQuestion).each(function(i) { $('.answer-item:first', this).append('<span class="inserted-label">'+$('.answertext', this).text()+'</span>'); $('.answer-item:last', this).prepend('<span class="inserted-label">'+$('.answertextright', this).text()+'</span>'); }); // Listener on the array cells $('.answer-item', thisQuestion).on('click', function(e) { $(':radio', this).trigger('click'); }); $('.answer-item :radio', thisQuestion).on('click', function(e) { e.stopPropagation(); }); // Some cleanup styling $('table.subquestion-list', thisQuestion).removeClass('ls-answers'); $('table.subquestion-list colgroup, table.subquestion-list thead, table.subquestion-list th', thisQuestion).remove(); $('table.subquestion-list label', thisQuestion).css({ 'margin': '-3px 0 0 0', 'padding': '0' }); $('table.subquestion-list .inserted-label', thisQuestion).css({ 'padding': '0 0.25em' }); $('table.subquestion-list td:first-child', thisQuestion).css({ 'text-align': 'left' }); $('table.subquestion-list td:last-child', thisQuestion).css({ 'text-align': 'right' }); }); </script>
Please Log in to join the conversation.
<div class="row row-no-gutters" style="font-size:16px;"> <div class="col-sm-6" style="text-align:left">Bold</div> <div class="col-sm-6" style="text-align:right">Meticulous</div> </div>
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Define this question var thisQuestion = $('#question{QID}'); // Move the last column $('col:nth-last-child(2)', thisQuestion).before($('col:last-child', thisQuestion)); $('table.subquestion-list tr', thisQuestion).each(function(i) { $('> *:nth-last-child(2)', this).before($('> *:last-child', this)); }); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ var thisQuestion = $('#question{QID}'); // Add a question class thisQuestion.addClass('custom-array'); // Column-specific classes $('table.subquestion-list tr', thisQuestion).each(function(i) { $('th, td', this).each(function(i) { $(this).addClass('column-'+i); }); }); }); </script> <style type="text/css"> .custom-array table.subquestion-list col { width: auto !important; } .custom-array table.subquestion-list tr .column-0 { width: 0%; } .custom-array table.subquestion-list tr .column-1 { width: 5%; } .custom-array table.subquestion-list tr .column-2 { width: 90%; } .custom-array table.subquestion-list tr .column-3 { width: 5%; } tr.ls-heading { display:none; } </style>
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.