- Posts: 14
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
You should export your survey (reduced version with only the relevant questions) as LSS and attach that file here.Kristoss wrote: I tired to set relevanceStatus within source code of text questions but with no success.
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify this question var thisQuestion = $('#question{QID}'); // Define the pool var pool = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]; // Shuffle the pool shuffleArray(pool); console.log('log - pool: '+ pool); // Define the exclusions var exclusions = { 1: [3,5,7,9,13], 2: [4,6,8,10,14], 3: [1,5,7,11,15], 4: [2,6,8,12,16], 5: [1,3,7,9,13], 6: [2,4,8,10,14], 7: [1,3,5,11,15], 8: [2,4,6,12,16], 9: [11,13,15,1,5], 10: [12,14,16,2,6], 11: [9,13,15,3,7], 12: [10,14,16,4,8], 13: [9,11,15,1,5], 14: [10,12,16,2,6], 15: [9,11,13,3,7], 16: [10,12,14,4,8] } // Loop through the multiple-numeric inputs $('input:text', thisQuestion).each(function(i){ // Load the input with the first element of the pool array var thisNumber = pool[0]; $('input:text:eq('+i+')', thisQuestion).val(thisNumber).trigger('keyup'); // Now, remove the first element of the pool array pool.splice(0, 1); // Remove pool elements per the exclusions var theseExclusions = exclusions[thisNumber]; console.log('log - exclusions: '+ theseExclusions); $.each(theseExclusions, function(i, val) { var index = pool.indexOf(val); if (index > -1) { pool.splice(index, 1); } }); console.log('log - pool: '+ pool); }); }); 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; } </script>
Q1_SQ001 == '1' OR Q1_SQ002 == '1' OR Q1_SQ003 == '1' OR Q1_SQ004 == '1'