- Posts: 6
- Thank you received: 0
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.
Looks like there are two groups of 12 questions (2x12). But that would still work with the solution you provided.But I do not understand where there are the two conditions.
Please Log in to join the conversation.
Please Log in to join the conversation.
<script type="text/javascript" charset="utf-8"> function shuffle(array) { var currentIndex = array.length, temporaryValue, randomIndex; // While there remain elements to shuffle... while (0 !== currentIndex) { // Pick a remaining element... randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; // And swap it with the current element. temporaryValue = array[currentIndex]; array[currentIndex] = array[randomIndex]; array[randomIndex] = temporaryValue; } return array; } $(document).on('ready pjax:scriptcomplete',function(){ // Fill the arrays var arrA = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"]; var arrB = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l"]; // Shuffle the arrays arrA = shuffle(arrA); arrB = shuffle(arrB); // Take the first 6 elements from both arrays, concat them and shuffle again var arrA1 = arrA.slice(0,6); var arrB1 = arrB.slice(0,6); var arr1 = arrA1.concat(arrB1); arr1 = shuffle(arr1).join('');; // Take the last 6 elements from both arrays, concat them and shuffle again arrA1 = arrA.slice(6,6); arrB1 = arrB.slice(6,6); var arr2 = arrA1.concat(arrB1); arr2 = shuffle(arr2).join(''); // Fill the text question $('#question{QID} input[type="text"]:eq(0)').val(arr1); $('#question{QID} input[type="text"]:eq(1)').val(arr2); // Remove the slashes in the next line // $('#question{QID}').hide(); }); </script>
Please Log in to join the conversation.
$('#question{QID} input[type="text"]:eq(0)').val(arr1).trigger('keyup');
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.
Your questions do not have a "randomization group name"I have a group of questions that contains 24 images divided into two conditions: 12 images belonging to condition 1 and 12 images belonging to condition
2a. Create questions for all 24 images at the beginning; all get the same "randomization group name"
2b. Create questions for all 24 images at the end; all get the same "randomization group name", but different from the first one.
Do it and send this lss.3. Now you use the function "strpos" to decide if an image is displayed or not.
So the conditions for images at the beginning are
1st image: strpos(QImage_SQ001,"A")>0
2nd image: strpos(QImage_SQ001,"B")>0
Please Log in to join the conversation.
Please Log in to join the conversation.
NOT in the questions you want to filter. Best you insert it into your first group.In a question of type "multiple short text" (QImage) insert this javascript snippet
Where do I have to apply the "strpos" function exactly?
Your questions do not have a "relevance equation" or "condition" (the wording differs in LS versions)
3. Now you use the function "strpos" to decide if an image is displayed or not.
So the conditions for images at the beginning are
1st image: strpos(QImage_SQ001,"A")>0
Please Log in to join the conversation.