- Posts: 10216
- Thank you received: 3635
Ask the community, share ideas, and connect with other LimeSurvey users!
Please Log in to join the conversation.
Please Log in to join the conversation.
<script type="text/javascript" charset="utf-8"> function maxDiff(qID, randomize) { // 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'); // 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[type="radio"]', thisQuestion).on('click', function () { $('input[type="radio"]', thisQuestion).prop('disabled', false); $('input[type="radio"]:checked', thisQuestion).each(function(i) { var thisRow = $(this).closest('tr.answers-list'); $('input[type="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; } $(document).ready(function(){ // Call the maxDiff() function // Set the second parameter to true for randomized rows maxDiff({QID}, true); }); </script> <style type="text/css">.ls-answers tbody .answertext { text-align: center; } </style>[/i][/i]
Please Log in to join the conversation.
Please Log in to join the conversation.
Now I am really confused.Er...no...
Please Log in to join the conversation.
Maybe. Can you please clear your cache and try again? If you still see a problem I'll edit it.Now I am really confused.
When I had a look at the workaround I saw a different code (with lots of "ui.").
Now it is the same as I showed here. (cache?)
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.
I do not understand that.Also display the Version along with set number
In my example there were only three sets, therefore "3"2. Create a random number from 1 to your number of versions (question type 'equation') (eqRand)
Please Log in to join the conversation.
Here you see the variables "Setx"To analyze later, you have to check which item was displayed in which set at which place.
This all you see in the text question "Set".
This way you can restructure the dataset to match the requirements of the analysis.
Why should it? Your survey is of the same size, there are no more calculations - only in QBase there are a few more linesSupposed if their is more 100 version that would be create problem for us & also impact on runtime
Please Log in to join the conversation.