How to add hint text for text entry for multi-language survey | XM Community
Solved

How to add hint text for text entry for multi-language survey


Badge +1

Hi,
I have a 7 language survey.
Few questions include a text entry that pops up once a response is checked.
For the hint text of the text entry, I'm using the following code:
Qualtrics.SurveyEngine.addOnload(function() {
var qid = this.questionId;
var placeholder1 = 'Please specify';
var placeholder2 = 'Please specify';

jQuery('#' + qid + ' .InputText')[0].setAttribute('placeholder',placeholder1);
jQuery('#' + qid + ' .InputText')[1].setAttribute('placeholder',placeholder2);
});
The issue is that "please specify" is the hint text to all languages which is not optimal.
How do I solve it and add hint text per language?

Thanks

icon

Best answer by ahmedA 5 July 2021, 15:46

View original

5 replies

Userlevel 7
Badge +21

Survey language is available via an internal ED. You can customize the placeholder value based on that.

Badge +1

ahmedA How exactly?

Badge +1

This is how it looks today:
Language - Espanol
Hint text - English:
image.png

Userlevel 7
Badge +21

Qualtrics.SurveyEngine.addOnReady(function () {
    let lang = "${e://Field/Q_Language}",
        placeholder_text;


    switch (lang) {
        case "EN-GB":
            placeholder_text = "Please Specify";
            break;
        case "ES-ES":
            placeholder_text = "Something else";
            break;
        default:
            placeholder_text = "Default Text that doesn't match any language";
    }
    this.questionContainer
        .querySelectorAll(".InputText")
        .forEach((tb) => (tb.placeholder = placeholder_text));
});

Badge +1

Amazing ahmedA :)
Thanks a lot!

Leave a Reply