- Posts: 5
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
randomization of particular subquestions in an array question
- romankoflerh
- Topic Author
- Offline
- New Member
Less
More
5 years 11 months ago #167379
by romankoflerh
randomization of particular subquestions in an array question was created by romankoflerh
Hello,
I'm using an array questions that has 18 subquestions. I want to randomize 17 subquestions (1-17) but the last one should always remain in the last place. Number 18 is not an exclusive option though.
Is there a possibility to do this?
thanks for your help
I'm using an array questions that has 18 subquestions. I want to randomize 17 subquestions (1-17) but the last one should always remain in the last place. Number 18 is not an exclusive option though.
Is there a possibility to do this?
thanks for your help
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12789
- Thank you received: 3940
5 years 11 months ago #167383
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic randomization of particular subquestions in an array question
Hi,
here you find it:
www.limesurvey.org/forum/can-i-do-this-w...few-at-bottom#157567
with a working example attached.
Two screenshots:
Joffm
here you find it:
www.limesurvey.org/forum/can-i-do-this-w...few-at-bottom#157567
with a working example attached.
Two screenshots:
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
The topic has been locked.
- romankoflerh
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
5 years 11 months ago #167414
by romankoflerh
Replied by romankoflerh on topic randomization of particular subquestions in an array question
Hello Joffm,
thanks a lot for your answer! It works fine for the array type question. However, now I need the same for a multiple choice question. According to the code you sent it should also work for such question type. Nevertheless, even in the example survey it only works for array but not multiple choice. Might be it's because of the limesurvey version I'm using (3.6.2)?
I also attached the file (it's Q3)
Maybe you or someone else has an idea - would be highly appreciated.
Thanks for your help!
thanks a lot for your answer! It works fine for the array type question. However, now I need the same for a multiple choice question. According to the code you sent it should also work for such question type. Nevertheless, even in the example survey it only works for array but not multiple choice. Might be it's because of the limesurvey version I'm using (3.6.2)?
I also attached the file (it's Q3)
Maybe you or someone else has an idea - would be highly appreciated.
Thanks for your help!
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
5 years 11 months ago - 5 years 11 months ago #167437
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic randomization of particular subquestions in an array question
There have been HTML structure changes in 3.x so the script now needs to like this:
Here is your sample survey back with those changes:
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify this question var qID = {QID}; var thisQuestion = $('#question'+qID); // Define the sub-question codes to be placed last var lastItems = ['SQ006', 'SQ007', 'SQ008']; // Loop through those sub-question codes $.each(lastItems, function(i, val) { // Move that item to the end of the list // Multi-choice question if($(thisQuestion).hasClass('multiple-opt')) { $('.question-item[id$=X'+qID+val+']', thisQuestion).appendTo($('.question-item[id$=X'+qID+val+']', thisQuestion).parent()); } // Array question if($(thisQuestion).hasClass('array-flexible-row')) { $('.answers-list[id$=X'+qID+val+']', thisQuestion).appendTo($('table.subquestion-list tbody:last', thisQuestion)); } // List-radio question if($(thisQuestion).hasClass('list-radio')) { $('.answer-item[id$=X'+qID+val+']', thisQuestion).appendTo($('.answer-item[id$=X'+qID+val+']', thisQuestion).parent()); } }); }); </script>
Here is your sample survey back with those changes:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
Last edit: 5 years 11 months ago by tpartner.
The topic has been locked.
- romankoflerh
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
5 years 11 months ago #167567
by romankoflerh
Replied by romankoflerh on topic randomization of particular subquestions in an array question
Works perfectly.
Thank you very much!
Thank you very much!
The topic has been locked.