Hi! I came up with some Javascript code to to set the placeholder text for text entry questions based on the language code of the survey.
Right now, it's set to look at the language code in Q-Language. I made 3 translations, and in all other cases the placeholder text should be Dutch.
It works, but I'm a beginner in JS and I can't predict potential future issues. I would appreciate some feedback!
Qualtrics.SurveyEngine.addOnReady(function() {
var placeholderText = "";
// Get the language code from the survey object
var Q_Language = Qualtrics.SurveyEngine.getEmbeddedData('Q_Language');
// Set the placeholder text based on the language code
if (Q_Language === "EN") {
placeholderText = "Please note: your answers will be taken literally and processed in the report.";
} else if (Q_Language === "DE") {
placeholderText = "Bitte beachten Sie: Ihre Antworten werden wörtlich übernommen und im Bericht verarbeitet.";
} else if (Q_Language === "FR") {
placeholderText = "Veuillez noter que vos réponses seront prises littéralement et traitées dans le rapport.";
} else {
placeholderText = "Let op; uw antwoorden worden letterlijk overgenomen en in de rapportage verwerkt.";
}
// Set the placeholder text for the text entry questions
jQuery("#" + this.questionId + " .InputText, .TextEntryBox").attr("placeholder", placeholderText);
});
See also: Adding warning to text entry box | XM Community (qualtrics.com)