Welcome to the LimeSurvey Community Forum

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

Re-ordering sub questions in translation

  • mainlevel
  • mainlevel's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 2 months ago #179644 by mainlevel
Re-ordering sub questions in translation was created by mainlevel
Dear all,
I'm having an issue with translating and re-ordering sub-questions. My survey is in two language (German / English). One multiple answer question has a long list of sub questions. The order of these sub questions needs to change in English (because it is alphabetical). Unfortunately, I cannot find out how to adjust the order of the sub-question in English.

I'd appreciate any help!!

Thank you so much!

Cheers
Daniel
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago #179651 by DenisChenu
Replied by DenisChenu on topic Re-ordering sub questions in translation
Just use Sort answers alphabetically (alphasort) question advanced setting manual.limesurvey.org/Question_type_-_Li...ally_.28alphasort.29

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • elissa
  • elissa's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago #179654 by elissa
Replied by elissa on topic Re-ordering sub questions in translation
It seems that there is no such a setting for multiple choice question.

Elzbieta Lesinska
LS voluntary Polish translator and supervisor
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago #179661 by DenisChenu
Replied by DenisChenu on topic Re-ordering sub questions in translation

elissa wrote: It seems that there is no such a setting for multiple choice question.

Oups,

Yes right elissa

Sorry, bad reading.

No included solution then … JS way or Question Template way (or plugin) maybe …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • elissa
  • elissa's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago #179662 by elissa
Replied by elissa on topic Re-ordering sub questions in translation
Maybe two questions each shown for different language? I'm not sure if you can set a condition on the language?

Elzbieta Lesinska
LS voluntary Polish translator and supervisor
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago #179666 by tpartner
Replied by tpartner on topic Re-ordering sub questions in translation
Placing this script in the source of a multiple-choice question in version 3.15.x will sort the sub-questions alphabetically:

Code:
<script type="text/javascript" charset="utf-8">
  $(document).on('ready pjax:scriptcomplete',function(){
 
    // Identify this question
    var thisQuestion = $('#question{QID}');
    var thisList = $('li.answer-item:eq(0)', thisQuestion).closest('ul');
 
    // Build an array of sub-question labels
    var optionsArr = [];
    $('li.answer-item', thisQuestion).each(function(i) {
      optionsArr.push($.trim($('label:eq(0)', this).text()));
    });
 
    // Sort the array
    optionsArr.sort();
 
    // Reposition the sub-questions
    $(optionsArr).each(function(i) {
      var thisVal = this;
      $('li.answer-item', thisQuestion).filter(function() {
        return $.trim($('label:eq(0)', this).text()) == thisVal;
      }).appendTo(thisList);
    });
  });
</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.

Lime-years ahead

Online-surveys for every purse and purpose