Check out the LimeSurvey source code on GitHub!

willing to donate for quick solution - drag/drop ranking headers

More
5 years 3 months ago #67920 by bwoo5
I am using the language selector for a multi-language survey. The survey has multiple ranking questions. The headings for the ranking questions are "your choices:" and "your rankings:" and these are being translated when the language is changed using the selector.

I have implemented the drag and drop ranking question style as explained in the documentation. However, the heading no longer get updated with the language selector. As the drag and drop ranking solution looks much better and works great I need for the headings to translate like the headings in the default ranking question.

Quick solution would be great as to what code I need to update in the drag drop ranking code to pull in the headers that update with the language selector. Willing to donate since you have helped out so much =)

Thanks.

Please Log in to join the conversation.

More
5 years 3 months ago #67927 by Mazi
Problem is that the texts are hardcoded at the Javascript code, see
<span class="dragDropHeader">Choices:</span><br /> \
OR
<span class="dragDropHeader">Ranking:</span><br /> \

A solution could be to copy the according code into the source code of each language version of your question and adjust the text strings at the source of each question.


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 3 months ago #67928 by bwoo5
what code exactly would I need to copy to each of my versions? If this will work where I can put the text I want for each ranking question heading at the question level it would be perfect so that all ranking questions don't have to have the same heading.

I see where they current setup has them hard coded into the template, so yes I need something at the question level to override this.

Please Log in to join the conversation.

More
5 years 3 months ago #67930 by tpartner
I think it would be safer to keep the code in one place and use variables dependent on the displayed lang (and/or questions) to adjust the text.

Can you give me a list of languages and your desired corresponding text?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
5 years 3 months ago #67932 by bwoo5
We work with all languages which is why I am looking for the drag and drop to have the same functionality as the standard ranking question where the your choices and your ranking change with the language selection. If it is possible to change those headings per question that would be ideal for us since we deal with a lot of ranking questions. If not customizable at the question source code level then they need to change like the default ranking. We are happy with the your choices and your ranking headings since it is already taken care of in all the language files,just need it to apply to the drag and drop code. Thanks

Please Log in to join the conversation.

More
5 years 3 months ago #67935 by tpartner
Okay, here's what we do...automatically pipe in the built-in LimeSurvey translations for the choices and ranking labels and also add some parameters so they can be overridden for specific questions.

In template.js, change this:
function dragDropRank(qID) {
To:
function dragDropRank(qID, choiceText, rankText) {
 
	if(!choiceText) {
		choiceText = $('#question'+qID+' td.label label').text();
	}
	if(!rankText) {
		rankText = $('#question'+qID+' td.output tr:first td:eq(1)').text();
	}

And this:
<span class="dragDropHeader">Choices:</span><br /> \
To:
<span class="dragDropHeader choicesLabel">'+choiceText+'</span><br /> \

And this:
<span class="dragDropHeader">Ranking:</span><br /> \
To:
<span class="dragDropHeader rankingLabel">'+rankText+'</span><br /> \


So, then if you call the function as follows (where "QQ" is the question ID) the LS translations will be piped into the drag-n-drop interface:
<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {  		
		dragDropRank(QQ);	
	});
</script>

But if you call it as follows, your custom text will be piped in:
<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {  		
		dragDropRank(QQ, 'Custom choice label', 'Custom rank label');	
	});
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
5 years 3 months ago #67936 by bwoo5
Thanks so much this is a big help. I will test it asap and when all is good we will be donating. Limesurvey is working out to be perfect for our company.

Please Log in to join the conversation.

More
5 years 3 months ago #67940 by Mazi
Tony, can you overwork the workaround or add a hint about how to best deal with multilingual surveys?


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 3 months ago #67953 by tpartner

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: bwoo5

Please Log in to join the conversation.

More
5 years 3 months ago #67963 by bwoo5
Thanks again for the quick solution, it worked out great.

Please Log in to join the conversation.

More
5 years 3 months ago #68045 by Mazi
You're welcome!


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form