- Posts: 2
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Partial randomization for ranking questions
- cyclingdecisions
- Topic Author
- Offline
- New Member
Less
More
6 years 10 months ago #155160
by cyclingdecisions
Partial randomization for ranking questions was created by cyclingdecisions
Hi!
I have a problem getting a ranking question partially randomized.
As I have three times the option 'other, please specify :<text>' I would like to randomize all factors except these three options. I found ways to do it for all kinds of questions but not for ranking questions in specific. Can anybody help me with this?
I have a problem getting a ranking question partially randomized.
As I have three times the option 'other, please specify :<text>' I would like to randomize all factors except these three options. I found ways to do it for all kinds of questions but not for ranking questions in specific. Can anybody help me with this?
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
6 years 10 months ago - 6 years 10 months ago #155163
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 Partial randomization for ranking questions
Assuming, for the sake of example, you wanted to fix sub-question codes "SQ005", "SQ006" and "SQ007" at the end of the choices list,
set up your survey to use JavaScript
and place the following script in the source of the question:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question code var qID = {QID}; // Define the sub-question codes to be positioned last var sqCodes = ['SQ005', 'SQ006', 'SQ007']; // Loop through those sq codes and place that sub-question at the end of the choices list $(sqCodes).each(function(i, code) { if($('#question'+qID+' .dragDropChoiceList li[id$="X'+qID+code+'"]').length > 0) { $('#question'+qID+' .dragDropChoiceList').append($('li[id$="X'+qID+code+'"]')); } }); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 10 months ago by tpartner.
The topic has been locked.
- cyclingdecisions
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
6 years 10 months ago #155167
by cyclingdecisions
Replied by cyclingdecisions on topic Partial randomization for ranking questions
Thank you so much, this is exactly what I needed!!!
The topic has been locked.
- Mazi
- Offline
- Official LimeSurvey Partner
2 months 1 week ago - 2 months 1 week ago #254675
by Mazi
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
Replied by Mazi on topic Partial randomization for ranking questions
For Limesurvey v5.x the code needs to be adjusted a little due to different CSS classes used there:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question code var qID = {QID}; // Define the sub-question codes to be positioned last var sqCodes = ['SQ005', 'SQ006', 'SQ007']; // Loop through those sq codes and place that sub-question at the end of the choices list $(sqCodes).each(function(i, code) { if($('#question'+qID+' .sortable-choice li[id$="X'+qID+code+'"]').length > 0) { $('#question'+qID+' .sortable-choice').append($('li[id$="X'+qID+code+'"]')); } }); }); </script>
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
Last edit: 2 months 1 week ago by Mazi. Reason: Added code tag
The topic has been locked.