- Posts: 117
- Thank you received: 9
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Partially randomise items in a ranking question
- paulfiner
- Topic Author
- Offline
- Premium Member
Less
More
3 months 2 weeks ago #254205
by paulfiner
Partially randomise items in a ranking question was created by paulfiner
Please help us help you and fill where relevant:
Your LimeSurvey version: 3.25.17
Own server or LimeSurvey hosting:Own
Survey theme/template:Fruity
==================
There are lots of workarounds for partially randomising lists for various question types but I couldn't find one for a ranking type question.
Is it possible to fix the last item of a list?
Thanks
Your LimeSurvey version: 3.25.17
Own server or LimeSurvey hosting:Own
Survey theme/template:Fruity
==================
There are lots of workarounds for partially randomising lists for various question types but I couldn't find one for a ranking type question.
Is it possible to fix the last item of a list?
Thanks
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
3 months 2 weeks ago #254207
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 Partially randomise items in a ranking question
Can you attach a small sample survey?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Please Log in to join the conversation.
- paulfiner
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 117
- Thank you received: 9
3 months 2 weeks ago #254209
by paulfiner
Replied by paulfiner on topic Partially randomise items in a ranking question
Sure, lss file attached
Attachments:
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
3 months 2 weeks ago - 3 months 2 weeks ago #254220
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 Partially randomise items in a ranking question
This script will fix items with answer codes listed in the fixedEndCodes array variable to the end of the choices list.
Sample survey attached:
Code:
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ // The answer codes of item(s) to be fixed var fixedEndCodes = ['9']; // Identify this question var qID = '{QID}'; var thisQuestion = $('#question'+qID); // Fix the item(s) to the end $.each(fixedEndCodes, function(i, code) { if($('ul.sortable-choice li[id$="X'+qID+code+'"]', thisQuestion).length > 0) { $('li[id$="X'+qID+code+'"]').appendTo($('ul.sortable-choice', thisQuestion)); } }); }); </script>
Sample survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 3 months 2 weeks ago by tpartner.
Please Log in to join the conversation.
- paulfiner
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 117
- Thank you received: 9
3 months 2 weeks ago #254221
by paulfiner
Replied by paulfiner on topic Partially randomise items in a ranking question
Thanks Tony, I'll have a go at this shortly.
Please Log in to join the conversation.