- Posts: 14458
- Thank you received: 4393
Ask the community, share ideas, and connect with other LimeSurvey users!
As I showed before. In one question of type "equation" to set your "hit" variables.then store the code "1" for the hid1 as a option "1"(Selected as code 1) then similarly for code "2" contain in Set_1 then it store the code "2" and for 3 and so on upto code 8
Where and when do you want to do this?Then for variable hid2 it filter form Set_2 then for variable hid3 it filter form Set_3 and so on
Please Log in to join the conversation.
Please Log in to join the conversation.
This is not the design of the maxdiff.I just look for the best way to implemented the max-diff design
I think the below are best for me
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.
maxDiff({QID}, true);
Please Log in to join the conversation.
function maxDiff(qID, randomize, disableMobileView) { // Identify some elements var thisQuestion = $('#question'+qID); var thisTable = $('table.subquestion-list:eq(0)', thisQuestion); // Assign a new question class $(thisQuestion).addClass('max-diff-array'); // Disable the mobile table view if(disableMobileView) { $(thisTable).removeClass('ls-answers').addClass('disable-mobile-view'); } // Move the columns $('thead tr:eq(0)', thisTable).prepend($('thead tr:eq(0) th:eq(1)', thisTable)); $('tr.answers-list', thisTable).each(function(i){ $('td.answer-item:eq(0)', this).prependTo(this); }); // Random rows if(randomize) { var rowsArr = []; $('tr.answers-list', thisTable).each(function(i){ $(this).attr('data-index', i); rowsArr.push(i); }); shuffleArray(rowsArr); $(rowsArr).each(function(i){ $('tbody', thisTable).append($('tr[data-index="'+this+'"]', thisTable)); }); } // Prevent clicking twice in the same row $('input:radio', thisQuestion).on('click', function () { $('input:radio', thisQuestion).prop('disabled', false); $('input:radio:checked', thisQuestion).each(function(i) { var thisRow = $(this).closest('tr.answers-list'); $('input:radio', thisRow).not(this).prop('disabled', true); }); }); // Fix up the row classes var rowClass = 1; $('tr.answers-list', thisTable).each(function(i) { $(this).addClass('array'+(2-(i%2))); }); } 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; }
.max-diff-array tbody th.answertext { text-align: center; font-weight: normal; } .max-diff-array table.disable-mobile-view > tbody > tr > td { vertical-align: middle; } .max-diff-array table.disable-mobile-view tbody td { text-align: center; }
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ // Call the maxDiff() function // Set the second parameter to true for randomized rows // Set the third parameter to true to disable the LS mobile table view maxDiff({QID}, true, true); }); </script>
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.