Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Do not rotate attributes in multiple and single questions

  • Eliott13
  • Eliott13's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 3 months ago #213353 by Eliott13
Hello dear community,

I have tried to find something in the forum to help me with this problem but I have not been successful in finding a specific answer.

I tell you that in the survey that I am doing, there is a group of questions where I must rotate the attributes of each of the questions, but the dilemma is that in each question I must leave some attributes fixed, that is, in the first question I do not I must rotate the first option, in the second question I must not rotate the second option and so on
Until I get to the last question where I should not rotate the last option.

Someone will know how to do this, maybe with Java I can do it but I have no idea with Java.
For technical reasons The version I am using now is Version 2.50

Thank you all. :)
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 3 months ago #213362 by Joffm
Hi,
which type of question is it?
list(radio)?
multiple?
multiple short text or multiple numeric?
array?



 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • Eliott13
  • Eliott13's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 3 months ago #213441 by Eliott13
Thanks joffm,

I am using both types of questions,

Both as multiple responses and unique radio responses.

Thanks again joffm
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 3 months ago #213461 by tpartner
Can you attach a small sample survey (.lss file) containing only the relevant questions?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Eliott13
  • Eliott13's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 3 months ago #213519 by Eliott13
Sure Tony

Below you will find the lss file of the survey.

Thank you very much again
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 3 months ago #213534 by tpartner
1) Place this script in the source of a question (this only needs to be inserted once per page).

Code:
<script type="text/javascript" data-author="Tony Partner">  
 
  function fixItemPosition(code, position, qID) {
    var thisQuestion = $('#question'+qID);
    var answerList = $('.answer-item:eq(0)', thisQuestion).parent();
    var answerItem = $('.answer-item[id$="X'+qID+code+'"]', thisQuestion);
    if(position == 1) {
      answerList.prepend(answerItem);
    }
    else {
 
      var clone = answerItem.clone(true);
      answerItem.remove();
      $($('.answer-item:eq('+(position-2)+')', thisQuestion)).after(clone);
    }
  }
</script>

2) Place this in the source of a list-radio or multiple-choice question. <br />Replace [answer/subquestion code] and [fixed position] as necessary.

Code:
<script type="text/javascript" data-author="Tony Partner">  
 
  $(document).on('ready pjax:scriptcomplete',function(){
 
    fixItemPosition('[answer/subquestion code]', [fixed position], {QID});
 
  });
</script>

So, if you want answer code "A2" in position 2.

Code:
<script type="text/javascript" data-author="Tony Partner">  
 
  $(document).on('ready pjax:scriptcomplete',function(){
 
    fixItemPosition('A2', 2, {QID});
 
  });
</script>

If you want answer code "A2" in position 2, answer code "A3" in position 3 and answer code "A4" in position 4.<br />(always start with the last item to be placed, working towards the first)

Code:
<script type="text/javascript" data-author="Tony Partner">  
 
  $(document).on('ready pjax:scriptcomplete',function(){
 
    fixItemPosition('A4', 4, {QID});
    fixItemPosition('A3', 3, {QID});
    fixItemPosition('A2', 2, {QID});
 
  });
</script>

Sample survey attached: 

File Attachment:

File Name: limesurvey...4(1).lss
File Size:41 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose