Display specific message in pop-up window according to selected language | XM Community
Solved

Display specific message in pop-up window according to selected language

  • 5 February 2024
  • 4 replies
  • 77 views

Badge +1

Daer all,

 

My first need was to display a pop-up window whenever a participant was selection “NO” to the question.

I have used this code  that works well from this post:

Qualtrics.SurveyEngine.addOnReady(function () {
let relevant_choice = this.questionContainer.querySelectorAll("li")[0];
relevant_choice.onclick = function (click) {
let recall = confirm("Do you really want to share?");
if (!recall) click.preventDefault();
};
});

 

Now, I need to have the message that corresponds to the selected language. My survey is in French and German.

How can I have a specific message for each language?

  1. Should I code it in the Javascript block of code? If so, how?
  1. Should I call a “validation message” that I would have previously created in my library? If so, how?

 

Many thanks for your help and attention.

icon

Best answer by Shashi 5 February 2024, 10:25

View original

4 replies

Userlevel 6
Badge +27

Create a hidden multichoice question. Hide this question by adding false display logic on it. In option 1 of this question put text : ‘Do you really want to share?’. Pipe in this choice description in your JS code as below:

Qualtrics.SurveyEngine.addOnReady(function () {
let relevant_choice = this.questionContainer.querySelectorAll("li")[0];
relevant_choice.onclick = function (click) {
let recall = confirm("${q://QIDXX/ChoiceDescription/1}");
if (!recall) click.preventDefault();
};
});

Once you translate the hidden question option using trnaslation feature of Qualtrics, automatically the pop up will show respective language.

Badge +1

Create a hidden multichoice question. Hide this question by adding false display logic on it. In option 1 of this question put text : ‘Do you really want to share?’. Pipe in this choice description in your JS code as below:

Qualtrics.SurveyEngine.addOnReady(function () {
let relevant_choice = this.questionContainer.querySelectorAll("li")[0];
relevant_choice.onclick = function (click) {
let recall = confirm("${q://QIDXX/ChoiceDescription/1}");
if (!recall) click.preventDefault();
};
});

Once you translate the hidden question option using trnaslation feature of Qualtrics, automatically the pop up will show respective language.

I am not fond of workaround, but this works well.  Thank you.

Also, my pop-up window requires 2 clicks on the “Ok” button before disappearing, while the “Cancel” button works normally with only 1 click. Do you know why?

Userlevel 6
Badge +27

Create a hidden multichoice question. Hide this question by adding false display logic on it. In option 1 of this question put text : ‘Do you really want to share?’. Pipe in this choice description in your JS code as below:

Qualtrics.SurveyEngine.addOnReady(function () {
let relevant_choice = this.questionContainer.querySelectorAll("li")[0];
relevant_choice.onclick = function (click) {
let recall = confirm("${q://QIDXX/ChoiceDescription/1}");
if (!recall) click.preventDefault();
};
});

Once you translate the hidden question option using trnaslation feature of Qualtrics, automatically the pop up will show respective language.

I am not fond of workaround, but this works well.  Thank you.

Also, my pop-up window requires 2 clicks on the “Ok” button before disappearing, while the “Cancel” button works normally with only 1 click. Do you know why?

I guess it is because we are testing using preview link. Please test using anonymous link and check.

Badge +1

Create a hidden multichoice question. Hide this question by adding false display logic on it. In option 1 of this question put text : ‘Do you really want to share?’. Pipe in this choice description in your JS code as below:

Qualtrics.SurveyEngine.addOnReady(function () {
let relevant_choice = this.questionContainer.querySelectorAll("li")[0];
relevant_choice.onclick = function (click) {
let recall = confirm("${q://QIDXX/ChoiceDescription/1}");
if (!recall) click.preventDefault();
};
});

Once you translate the hidden question option using trnaslation feature of Qualtrics, automatically the pop up will show respective language.

I am not fond of workaround, but this works well.  Thank you.

Also, my pop-up window requires 2 clicks on the “Ok” button before disappearing, while the “Cancel” button works normally with only 1 click. Do you know why?

I guess it is because we are testing using preview link. Please test using anonymous link and check.

Unfortunately, with the anonymous link it behaves the same way.

Do you have the similar behavior when you try using this code as well?

Leave a Reply