- Posts: 18
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Answers random order - partial randomization & keeping distinct answers fixed
- rasheed
- Offline
- New Member
Less
More
8 years 2 months ago #131395
by rasheed
Replied by rasheed on topic Answers random order - partial randomization & keeping distinct answers fixed
I tested this with List (radio) question and it didn't work. Not sure if the script is compatible with 2.05 am using.
Thank you
Thank you
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
8 years 2 months ago #131399
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 Answers random order - partial randomization & keeping distinct answers fixed
Tested what? There are several scripts in this thread. What are you trying to do and what script have you used?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- rasheed
- Offline
- New Member
Less
More
- Posts: 18
- Thank you received: 0
8 years 2 months ago #131401
by rasheed
Replied by rasheed on topic Answers random order - partial randomization & keeping distinct answers fixed
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
8 years 2 months ago #131405
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 Answers random order - partial randomization & keeping distinct answers fixed
I find that the survey supplied in the workaround works in 2.05. Have you tried with the default template? Do you have any JavaScript errors?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- rasheed
- Offline
- New Member
Less
More
- Posts: 18
- Thank you received: 0
8 years 2 months ago #131407
by rasheed
Replied by rasheed on topic Answers random order - partial randomization & keeping distinct answers fixed
I think i found the reason. It doesn't actually work when answers are displayed in columns...
The topic has been locked.
- rasheed
- Offline
- New Member
Less
More
- Posts: 18
- Thank you received: 0
8 years 2 months ago #131453
by rasheed
Replied by rasheed on topic Answers random order - partial randomization & keeping distinct answers fixed
Is there any solution to make work with columns please ?
Thank you !
Thank you !
The topic has been locked.
- kapelas
- Offline
- New Member
Less
More
- Posts: 1
- Thank you received: 1
8 years 1 month ago #133153
by kapelas
Replied by kapelas on topic Answers random order - partial randomization & keeping distinct answers fixed
Regarding rasheed 's link in limesurvey, I would like to submit a small conversion to the script for partially randomize question in Array AND having the Repeat headers activated.
So, regarding the exact link
manual.limesurvey.org/Workarounds:_Manip...rs_-_Array_questions
If you add the <tag>:last</tag>, to point to the last descendant of the tbody, you add the question ONLY on the last tbody section of the repeated sections, otherwise the fixed sub-questions is added on every tbody section.
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
...
// Move the "fixed" row to the end
$('table.subquestions-list tbody:last', thisQuestion).append($('tr[id$="X'+q1ID+fixedCode+'"]'));
...
</script>
So, regarding the exact link
manual.limesurvey.org/Workarounds:_Manip...rs_-_Array_questions
If you add the <tag>:last</tag>, to point to the last descendant of the tbody, you add the question ONLY on the last tbody section of the repeated sections, otherwise the fixed sub-questions is added on every tbody section.
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
...
// Move the "fixed" row to the end
$('table.subquestions-list tbody:last', thisQuestion).append($('tr[id$="X'+q1ID+fixedCode+'"]'));
...
</script>
The following user(s) said Thank You: tpartner
The topic has been locked.
- Blume
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
7 years 10 months ago #136519
by Blume
Replied by Blume on topic Answers random order - partial randomization & keeping distinct answers fixed
Hi,
is there also a solution for multiple choice/option questions?
I want to randomize answer options of a multiple choice/option question, but keep the last input answer and other fix. I work with Version 2.06.
My example:
Answer A
Answer B
Answer C
Answer D
Other (advance settings)
--> Answer D and "other" should be fixed and not randomized.
is there also a solution for multiple choice/option questions?
I want to randomize answer options of a multiple choice/option question, but keep the last input answer and other fix. I work with Version 2.06.
My example:
Answer A
Answer B
Answer C
Answer D
Other (advance settings)
--> Answer D and "other" should be fixed and not randomized.
The topic has been locked.
- michaelve
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
7 years 2 months ago #148503
by michaelve
Replied by michaelve on topic Answers random order - partial randomization & keeping distinct answers fixed
I wanted to realize more or less the same goal, but instead of having a list, I wanted to have an array type question with partial randomization. By modifying the code of tpartner I managed to realize this. Note that the CSS has to be tweaked as well for the odd and even rows in the table, hence the second loop.
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+' .answers-list').length; //alert(ansCount); // 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 = $('tr[id$="X'+qID+(ansCount-fixedIndex)+'"]'); var table = $('table.subquestion-list'); $(table).append(answer); fixedIndex--; } // Update the classes of the odd and even rows for the css for (var i=0; i<ansCount; i++) { var answer = $('tr.answers-list:eq('+i+')'); var evenOrOdd = i %2; if(evenOrOdd==1) { if ($(answer).hasClass('array2')) { $(answer).removeClass('array2'); $(answer).addClass('array1'); } } if(evenOrOdd==0) { if ($(answer).hasClass('array1')) { $(answer).removeClass('array1'); $(answer).addClass('array2'); } } } }); </script>
The topic has been locked.
- bsommerhalder
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
6 years 10 months ago #155306
by bsommerhalder
Replied by bsommerhalder on topic Answers random order - partial randomization & keeping distinct answers fixed
Hi everyone,
I've been reading through docs and these forums, I hope I haven't missed the solution to this question somewhere.
I have a multiple choice list with an "Other" option, and my subquestions are not sequentially named, as I am attempting to match variable naming to programming from another provider (migrating to Lime).
I would like to randomize my list of subquestions, but at the end of the list, always have OTHER, followed by "None". Desired behaviour.
SubQ A
SubQ B ...
SubQ X
SubQ OTHER
SubQ NONE
Where SubQ A thru SubQ X are randomized, but SubQ OTHER and SubQ NONE remain in the second-last and last position in the list, respectively.
I've tried making adaptations to various examples in this thread to no avail.
Is anyone able to assist with this?
Many thanks in advance.
I've been reading through docs and these forums, I hope I haven't missed the solution to this question somewhere.
I have a multiple choice list with an "Other" option, and my subquestions are not sequentially named, as I am attempting to match variable naming to programming from another provider (migrating to Lime).
I would like to randomize my list of subquestions, but at the end of the list, always have OTHER, followed by "None". Desired behaviour.
SubQ A
SubQ B ...
SubQ X
SubQ OTHER
SubQ NONE
Where SubQ A thru SubQ X are randomized, but SubQ OTHER and SubQ NONE remain in the second-last and last position in the list, respectively.
I've tried making adaptations to various examples in this thread to no avail.
Is anyone able to assist with this?
Many thanks in advance.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
6 years 10 months ago #155307
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 Answers random order - partial randomization & keeping distinct answers fixed
LimeSurvey version?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- bsommerhalder
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
6 years 10 months ago #155308
by bsommerhalder
Replied by bsommerhalder on topic Answers random order - partial randomization & keeping distinct answers fixed
Apologies, version: 2.64.7+170404
The topic has been locked.