Welcome to the LimeSurvey Community Forum

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

Order of sub questions from previous question

  • CarolinEkman
  • CarolinEkman's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 7 months ago #172797 by CarolinEkman
Replied by CarolinEkman on topic Order of sub questions from previous question
Our aim is to launch this survey on Monday.

Do you know how much more time I can expect it to take to have the bug report processed? I just checked it now again and I don't see any response?
The topic has been locked.
More
5 years 7 months ago #172799 by jelo

CarolinEkman wrote: Do you know how much more time I can expect it to take to have the bug report processed?

Even if the bug would be fixed anytime soon, your LimeSurvey version will not receive any fix. That's why I recommend to contact the admin of your installation. The WHO has some connections to LimeSurvey regarding special modifications.

The 2.06+ Build 151215 isn't officially supported anymore. The current supported release of your LS branch is the LTS release 2.6.7-lts Build 171212 of December 2017. But the official support is only fixing security releated bugs.

Personally I would plan without that feature and escalate the issue to the admin or IT-manager.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • CarolinEkman
  • CarolinEkman's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 7 months ago #172801 by CarolinEkman
Replied by CarolinEkman on topic Order of sub questions from previous question
OK, I see! Thanks for your answer! So you mean I should contact someone internally at WHO who may know about this specific version of LimeSurvey?
The topic has been locked.
More
5 years 7 months ago #172802 by jelo

CarolinEkman wrote: So you mean I should contact someone internally at WHO who may know about this specific version of LimeSurvey?

As a LimeSurvey user you just want your tool to work.
The whole LS development efforts are on LS 3. You will run into more and more issues over time and will stop using the tool at all, if you don't get to LS3. I don't know how many LS installations the WHO is maintaining, but I have heard that some LS installations are modified for get panel work done (so no official LS version with a simple update/upgrade path). The person responsible for your LS installation might know how to get a new version of LS or why you have to stay on that LS version. The LimeSurvey support might know that too. You may open a ticket via "Support" right at the top.

It all won't resolve the issue for your next survey project. But if you expect to do more survey work in the near future, it might be wise to act know. Will help, to not hang out on the LimeSurvey forum that often and long.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • CarolinEkman
  • CarolinEkman's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 7 months ago #172803 by CarolinEkman
Replied by CarolinEkman on topic Order of sub questions from previous question
so you think that unless I het a different version of LS, I wont be able to fix this specific issue? Just not so sure I can expect this to happen quickly. As you say, I just want to make it work at this poins :)
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago #172814 by tpartner
Replied by tpartner on topic Order of sub questions from previous question
Are the questions on the same page? (we never did get a short test survey)

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
5 years 7 months ago #172816 by jelo

tpartner wrote: Are the questions on the same page? (we never did get a short test survey)

Take the survey from my bugreport. bugs.limesurvey.org/view.php?id=13978
I never used the feature.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago #172818 by tpartner
Replied by tpartner on topic Order of sub questions from previous question
Okay, in that survey the questions are in separate groups, so a JavaScript solution would be...

1) Remove the "Get order from previous question" setting from the second array question.

2) Insert a new short-text question directly after the first array question with question code "q1Order".

3) Insert this script in the source of the short-text question. It will hide that question and load it with the sub-question order of the first array.
Code:
<script type="text/javascript" charset="utf-8">
 
  $(document).ready(function() {
 
    // Identify the questions
    var thisQuestion = $('#question{QID}');
    var prevQuestion = $(thisQuestion).prevAll('div[id^="question"]:eq(0)');
    var prevQCode = $(prevQuestion).attr('id').replace(/question/, '');
 
    // Hide this question
    $(thisQuestion).hide();
 
    // An array for the sub-question codes
    var sqCodes = [];
 
    // Loop through the previous question sub-questions
    $('tr[id^="javatbd"]', prevQuestion).each(function(i) {
      var thisCode = $(this).attr('id').split('X'+prevQCode)[1];
      sqCodes.push(thisCode);
    });
 
    // Load the input
    $('input:text:eq(0)', thisQuestion).val(sqCodes);
    });
</script>

4) Add this script to the source of the second array. It will retrieve the sub-question order from the hidden question and move the array rows accordingly.
Code:
<script type="text/javascript" charset="utf-8">
 
  $(document).ready(function() {
 
    // Identify this question
    var thisQuestion = $('#question{QID}');
 
    // Get the previous sub-question codes
    var sqCodes = '{q1Order}'.split(',');
 
    // Loop through the previous question sub-question codes
    $.each(sqCodes, function(i, val) {
      // Move the corresponding array row
      $('table.subquestions-list tbody:eq(0)', thisQuestion).append($('tr[id$="X{QID}'+val+'"]'));
    });
 
    // Fix up array row background colours
    $('table.subquestions-list tbody > tr', thisQuestion).each(function(i){
      $(this).removeClass('array1 array2').addClass('array'+(2-(i%2)));
    });
    });
</script>

Attached is a working sample survey for LS 2.06.

File Attachment:

File Name: limesurvey...6319.lss
File Size:22 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.
  • CarolinEkman
  • CarolinEkman's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 7 months ago #172822 by CarolinEkman
Replied by CarolinEkman on topic Order of sub questions from previous question
Thanks a lot!
So I would have to do this work around because the questions are in different groups?

I was hoping that I wouldnt have to work with javascript :)
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago #172823 by tpartner
Replied by tpartner on topic Order of sub questions from previous question
From what I understand, the LimeSurvey "Get order from previous question" setting is broken in your version so you will need to use JavaScript regardless of where the questions are located.

This solution is for separate groups as that is how I found them in Jelo's test survey.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
5 years 7 months ago #172827 by jelo

tpartner wrote: From what I understand, the LimeSurvey "Get order from previous question" setting is broken in your version so you will need to use JavaScript regardless of where the questions are located.

I haven't found a version where it is working. Did it work in LS 3 for you, Tony?

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago #172830 by tpartner
Replied by tpartner on topic Order of sub questions from previous question

I haven't found a version where it is working. Did it work in LS 3 for you, Tony?

Nope, and I tried both question ID and question code as the tip indicates ID.


Cheers,
Tony Partner

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

Lime-years ahead

Online-surveys for every purse and purpose