Only display certain language options | XM Community
Skip to main content

Hi, I'm conducting a survey in several languages and have set the survey links up so that respondents are sent the survey in the language of their country. However, in Canada I don't know in advance whether respondents are in French or English speaking areas so I need to allow respondents to select the option for French Canadian (the survey link is sent in US English). However, I also have an option for European french in my language options because the survey is also being conducted in France. This option has France-specific wording and question options. I don't want French-Canadian respondents to be able to select European French by accident as their language (this has happened during my soft launch of the survey). Is there a way that I can display ONLY french-canadian and US English as the language options for Canadian respondents?

sarah_hill
I think you can use the inbuilt feature of adding language code within XM Directory contact information. Once done the survey will auto open in the language which is included in the XM Directory.
If you need, the option of hiding the language options. You will need to include JavaScript to hide certain languages based on if they are French-Canadian or European-French. You can include the country in an embedded field as below. You can do the same for french Canadian and replace the country and language code.
Qualtrics.SurveyEngine.addOnload(function() {
  if("${e://Field/country}"=="European-French") {
  jQuery("select.Q_lang").find("optionovalue='FR-CA']").hide();
  }
});
Hope it helps!


https://community.qualtrics.com/XMcommunity/discussion/comment/50977#Comment_50977Thanks Deepak, Since respondents don't select their country until after the information and consent pages, the javascript won't work at the beginning of the survey. Is it possible to base the logic on an ID? For instance, all Canadian respondents are assigned an ID that is prefixed by "CA" then a number. Can you use wildcards to tell the language options to display is someone has an ID that is "CAXXX" where XX will be a number?


https://community.qualtrics.com/XMcommunity/discussion/comment/50998#Comment_50998Yes, you can do that include the ID in mailing list pull that in an embedded data and then within javascript include it like country=CAXXX. Include this in top of survey flow and include JS in header source with script tag.
Hope it helps!


https://community.qualtrics.com/XMcommunity/discussion/comment/50999#Comment_50999Thank you that's worked now!


https://community.qualtrics.com/XMcommunity/discussion/comment/50999#Comment_50999Hi again,
Is it possible to add on other languages that I would like to hide? So for example, also hide "EN-EN" which is the UK English version rather than the north American English version. I tried to use "&&" to combine to if functions but it didn't work...


https://community.qualtrics.com/XMcommunity/discussion/comment/51003#Comment_51003Yes you can just copy paste the same jQuery line below it and change the option value to that code.


sarah_hill ,
Hiding select options doesn't work in all browsers (e.g., Safari). You should disable and hide. That way, if hide doesn't work, it is disabled and can't be selected. Just modify the JS line:
jQuery("select.Q_lang").find("option[value='FR-CA']").prop("disabled",true).hide();


https://community.qualtrics.com/XMcommunity/discussion/comment/51018#Comment_51018Thanks Tom, that's really useful. I will give that additional code a try!


It’s an old post and this is probably a long shot. But how can I apply this code (or any similar code for that matter) globally across the survey without having to apply it for each question?


It’s an old post and this is probably a long shot. But how can I apply this code (or any similar code for that matter) globally across the survey without having to apply it for each question?

Place it in the survey header inside a <script> tag.


It’s an old post and this is probably a long shot. But how can I apply this code (or any similar code for that matter) globally across the survey without having to apply it for each question?

Place it in the survey header inside a <script> tag.

@TomG  Thank you. I tried putting this in the footer (because I have other script in the header to show dynamic logo based on an embedded field), but the script is showing up directly on screen. What am I doing wrong?

 

<script>

Qualtrics.SurveyEngine.addOnload(function() {

  if("${e://Field/country}"=="DE") {

jQuery("select.Q_lang").find("optionovalue='EN-GB']").prop("disabled",true).hide();

  }

});

</script>


It’s an old post and this is probably a long shot. But how can I apply this code (or any similar code for that matter) globally across the survey without having to apply it for each question?

Place it in the survey header inside a <script> tag.

@TomG  Thank you. I tried putting this in the footer (because I have other script in the header to show dynamic logo based on an embedded field), but the script is showing up directly on screen. What am I doing wrong?

 

<script>

Qualtrics.SurveyEngine.addOnload(function() {

  if("${e://Field/country}"=="DE") {

jQuery("select.Q_lang").find("optionovalue='EN-GB']").prop("disabled",true).hide();

  }

});

</script>

@Dhananjayan Palaniswamy It’s a script that gonna work it in the source mode of the header like what you’re doing with dynamic logo. Don’t worry, it shouldn’t conflict with the dynamic logo script.

 


It’s an old post and this is probably a long shot. But how can I apply this code (or any similar code for that matter) globally across the survey without having to apply it for each question?

Place it in the survey header inside a <script> tag.

@TomG  Thank you. I tried putting this in the footer (because I have other script in the header to show dynamic logo based on an embedded field), but the script is showing up directly on screen. What am I doing wrong?

 

<script>

Qualtrics.SurveyEngine.addOnload(function() {

  if("${e://Field/country}"=="DE") {

jQuery("select.Q_lang").find("optionovalue='EN-GB']").prop("disabled",true).hide();

  }

});

</script>

@Dhananjayan Palaniswamy It’s a script that gonna work it in the source mode of the header like what you’re doing with dynamic logo. Don’t worry, it shouldn’t conflict with the dynamic logo script.

 

@dxconnamnguyen  That worked 🙂 Thanks a lot!


Leave a Reply