Re-ordering sub questions in translation

More
1 month 3 weeks ago #179644 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

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
1 month 3 weeks ago #179651 by DenisChenu
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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in or Create an account to join the conversation.

More
1 month 3 weeks ago #179654 by elissa
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

Please Log in or Create an account to join the conversation.

More
1 month 3 weeks ago #179661 by DenisChenu

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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in or Create an account to join the conversation.

More
1 month 3 weeks ago #179662 by elissa
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

Please Log in or Create an account to join the conversation.

More
1 month 3 weeks ago #179666 by tpartner
Placing this script in the source of a multiple-choice question in version 3.15.x will sort the sub-questions alphabetically:

<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.

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!