For various reasons I would like to let my respondents select their language with a question instead of the language drop down selector. I found the code to do this over here: https://gist.github.com/marketinview/48187d5251ac0fedf555cbd0f2ac7c7a. It works perfectly when I add a list question. However, I would like to know how I can change this code so that it works with a dropdown question? I’ve tried a couple of things myself but I’m unable to hide the langCodes if I change the question from a list to a dropdown.
Select language with dropdown question instead of language drop down selector
Best answer by Tom_1842
So I don’t think you can use <span> inside of a select element's <option>, which is how the Multiple Choice dropdown is laid out. So you will see EnglishEN, FrenchFR, etc. Instead, you can include the language without the language code, and use JS to set the language code based on the selected language. Try creating a Multiple Choice question and set its Format to Dropdown, add the choices "English" and "French" and then add the below to the question's JavaScript in the OnReady section:
jQuery("#"+this.questionId+" select").on('input', function() {
var selectedOption = jQuery(this).find("option:selected").text();
if (selectedOption == "English"){
var langCode = "EN";
}
if (selectedOption == "French"){
var langCode = "FR";
}
jQuery("#Q_lang").val(langCode).trigger('change');
});
Sign up
Already have an account? Login
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login to the Community
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
