- Posts: 85
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
My versión LS is: Versión 3.25.10+210128
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.
Haha,Probably Joffm has a good solution, I am sure.
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.
Please Log in to join the conversation.
LimeSurvey does not store the order. So how do you decide which are the "first 5"?Of the selected brands, I am only taking the first 5 to apply my next questions, which are Q21 and Q21a.
<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(){ var strp=$('#question{QID} input[type="text"]:eq(0)').val().replace(/\s+/g, ''); var stro=$('#question{QID} input[type="text"]:eq(1)').val().replace(/\s+/g, ''); // Fill the arrays var arrp = strp.split(','); var arro = stro.split(','); // Shuffle and truncate arrp = shuffle(arrp); arrp = arrp.slice(0,5).join(''); arro = shuffle(arro); arro = arro.slice(0,5).join(''); // Fill the subquestion with the results $('#question{QID} input[type="text"]:eq(0)').val(arrp); $('#question{QID} input[type="text"]:eq(1)').val(arro); $('#ls-button-submit').trigger('click'); }); </script>
Please Log in to join the conversation.
Exactly, this is what the "list" function does.it registers commas to separate each brand
Please Log in to join the conversation.