!
However, I need to translate this to German, Spanish and Dutch (both the calendar itself and the output).
!
How would I go about this?
Thank you in advance
Best answer by TomG
View originalBest answer by TomG
View originalI want to use the code but I have problems.
I pasted the same code on the JS part but do I need to have a code in my header ? how can I do this please
https://community.qualtrics.com/XMcommunity/discussion/comment/47311#Comment_47311The code above uses the pikaday library that would you need to load in the header (Look & Feel -> General -> Header -> Source mode <>). Load it from a cdn like jsdelivr.
Personally, I recommend flatpickr instead.
Thank you Tom for you answer .
I used this code into my JS :
Qualtrics.SurveyEngine.addOnload(function()
{
var inputId = 'QR~' + this.questionId;
var languages = {
"FR": {
months: ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Aout','Septembre','Octobre','Novembre','Décembre'],
weekdays: ['Dimache','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
},
};
var picker = new Pikaday(
{
field: document.getElementById(inputId),
firstDay: 1,
defaultDate: new Date(2000,0),
i18n: languages['${e://Field/Q_Language}'],
format: "DD/MM/YYYY",
onSelect: function(date) {
var todayInSeconds = new Date().getTime();
var birthdayInSeconds = date.getTime();
var ageInSeconds = todayInSeconds - birthdayInSeconds;
var ageInYears = Math.floor(ageInSeconds / (1000 * 3600 * 24) / 365);
Qualtrics.SurveyEngine.setEmbeddedData("Age", ageInYears);
},
});
});
Qualtrics.SurveyEngine.addOnReady(function()
{
jQuery("#"+this.questionId+" .InputText").attr("readonly",true);
});
And for the Header this one :
https://cdnjs.cloudflare.com/ajax/libs/pikaday/1.6.1/css/pikaday.min.css" rel="stylesheet" type="text/css" />">https://cdnjs.cloudflare.com/ajax/libs/pikaday/1.6.1/pikaday.min.js">
But it's not working what should I do please ?
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.