- Posts: 2
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
randomization couple of question
- elestat
- Topic Author
- Offline
- New Member
Less
More
9 years 4 months ago #113980
by elestat
randomization couple of question was created by elestat
Hy everybody! I am conducting a survey whose data will be used also for my graduation
thesis. In our survey questionnaire we randomize an array of items and ask
respondents to choose some "best" (most important) items and, as a second
question, the "worst" (least important) item from the reduced array. We
are unable to keep the initially randomized array because LimeSurvey newly
randomize the array for the second question.
Does anybody know if and how it is possible to keep for the second
question the same order of the items as the initial randomization (that is the same order of the randomized items of the first question)?
Thank you very much.
thesis. In our survey questionnaire we randomize an array of items and ask
respondents to choose some "best" (most important) items and, as a second
question, the "worst" (least important) item from the reduced array. We
are unable to keep the initially randomized array because LimeSurvey newly
randomize the array for the second question.
Does anybody know if and how it is possible to keep for the second
question the same order of the items as the initial randomization (that is the same order of the randomized items of the first question)?
Thank you very much.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3690
9 years 4 months ago #113994
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 couple of question
What version of LimeSurvey are you using?
Are both questions on the same page?
.
Are both questions on the same page?
.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- elestat
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
9 years 4 months ago #114002
by elestat
Replied by elestat on topic randomization couple of question
Version: 2.05 (+ Build 140717)
Both questions are on the same page, but I can put them on different pages if necessary
Both questions are on the same page, but I can put them on different pages if necessary
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3690
9 years 4 months ago #114025
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 couple of question
If both questions are of
basic array type
and are sequential on the same page...
1) Set up your survey to use JavaScript .
2) Set Q1 to random answer order.
3) Place the following script in the source of Q1.
Sample survey:
1) Set up your survey to use JavaScript .
2) Set Q1 to random answer order.
3) Place the following script in the source of Q1.
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ // Identify the questions var q1ID = '{QID}'; var q1 = $('#question'+q1ID+''); var q2 = $(q1).nextAll('.array-flexible-row:eq(0)'); var q2ID = $(q2).attr('id').split('question')[1]; // Sort the Q2 array rows into same order as Q1 $('tr.answers-list', q1).each(function(i){ var thisCode = $(this).attr('id').split('X'+q1ID)[1]; $('table.subquestions-list tbody', q2).append($('tr.answers-list[id$="X'+q2ID+thisCode+'"]')); }); // Fix up the Q2 array row background colours $('tr.answers-list', q2).each(function(i){ $(this).removeClass('array1 array2').addClass('array'+(2-(i%2))); }); }); </script>
Sample survey:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The topic has been locked.