- Posts: 5
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Partially randomized answers (list radio type) in 2.50
- tarantel999
- Topic Author
- Offline
- New Member
Less
More
7 years 9 months ago - 7 years 9 months ago #138854
by tarantel999
Partially randomized answers (list radio type) in 2.50 was created by tarantel999
For some reason the code that has worked on previous version doesn't seem to do that on 2.50. What should I do differently?
Is there a working solution for this?
manual.limesurvey.org/Workarounds:_Manip...tions_.28Enhanced.29
Is there a working solution for this?
manual.limesurvey.org/Workarounds:_Manip...tions_.28Enhanced.29
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // The number of answers to be fixed at the end of the list var fixedAnswers = 2; // Identify this question var qID = {QID}; // Find the number of answers var ansCount = $('#question'+qID+' li.answer-item').length; // Place the last n answers created at the end of the list var fixedIndex = fixedAnswers - 1; for (var i=0; i<fixedAnswers; i++) { var answer = $( 'input[id$="X'+qID+(ansCount-fixedIndex)+'"]'); var answerItem = $(answer).closest('li'); var answersList = $(answer).closest('ul'); $(answersList).append(answerItem); fixedIndex--; } }); </script>
Last edit: 7 years 9 months ago by tarantel999.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10114
- Thank you received: 3595
7 years 9 months ago #138876
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 randomized answers (list radio type) in 2.50
In LimeSurvey 2.50, you need to use this script:
I have updated the workaround accordingly - manual.limesurvey.org/Workarounds:_Manip...tions_.28Enhanced.29
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // The number of answers to be fixed at the end of the list var fixedAnswers = 2; // Identify this question var qID = {QID}; // Find the number of answers var ansCount = $('#question'+qID+' .answer-item').length; // Place the last n answers created at the end of the list var fixedIndex = fixedAnswers - 1; for (var i=0; i<fixedAnswers; i++) { var answer = $('input[id^="answer"][id$="X'+qID+(ansCount-fixedIndex)+'"]'); var answerItem = $(answer).closest('.answer-item'); var answersList = $(answer).closest('.answers-list'); if($('#question'+qID).hasClass('multiple-opt')) { answerItem = $(answer).closest('.answer-item').parent(); answersList = $(answer).closest('.subquestion-list'); } $(answersList).append(answerItem); fixedIndex--; } }); </script>
I have updated the workaround accordingly - manual.limesurvey.org/Workarounds:_Manip...tions_.28Enhanced.29
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: vkuzmin
The topic has been locked.
- gyts
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
7 years 9 months ago #139218
by gyts
Replied by gyts on topic Partially randomized answers (list radio type) in 2.50
Hi, thanks for all your help. It seems that i cannot make work this. I upload the example file and it doenst work. Maybe its a server problem or something that i have to change in the code.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10114
- Thank you received: 3595
7 years 9 months ago #139221
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 randomized answers (list radio type) in 2.50
Did you import the correct file? There is one for 2.06 and another for 2.5. Do you have any JavaScript errors in the console?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- gyts
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
7 years 9 months ago #139228
by gyts
Replied by gyts on topic Partially randomized answers (list radio type) in 2.50
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10114
- Thank you received: 3595
7 years 9 months ago #139229
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 randomized answers (list radio type) in 2.50
Can you activate that survey and give a link?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- gyts
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
7 years 9 months ago #139230
by gyts
Replied by gyts on topic Partially randomized answers (list radio type) in 2.50
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10114
- Thank you received: 3595
7 years 9 months ago - 7 years 9 months ago #139232
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 randomized answers (list radio type) in 2.50
The workaround instructions say 'The "Show No answer" survey setting must be set to "No" ' -
manual.limesurvey.org/Workarounds:_Manip...tions_.28Enhanced.29
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 7 years 9 months ago by tpartner.
The topic has been locked.
- gyts
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
7 years 3 months ago #147457
by gyts
Replied by gyts on topic Partially randomized answers (list radio type) in 2.50
Im again with this problem. I change the server and cannot do it. I had imported the example and doest work.
Could you help me please?
gyts.ga/index.php/874188?lang=en
Could you help me please?
gyts.ga/index.php/874188?lang=en
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10114
- Thank you received: 3595
7 years 3 months ago #147468
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 randomized answers (list radio type) in 2.50
You're not using the 2.50 script.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- gyts
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
7 years 3 months ago #147469
by gyts
Replied by gyts on topic Partially randomized answers (list radio type) in 2.50
im so stupid. I missread. Im sorry pal, thank for the patience
The topic has been locked.
- blocka
- Offline
- Platinum Member
Less
More
- Posts: 409
- Thank you received: 34
6 years 5 months ago #160906
by blocka
Replied by blocka on topic Partially randomized answers (list radio type) in 2.50
I cannot get this to work on a list type (radio) question. It works fine when using multiple choice.
I've attached my LSS -- using LS version 2.72.4 build 171110
Can anyone help?
I've attached my LSS -- using LS version 2.72.4 build 171110
Can anyone help?
Attachments:
The topic has been locked.