I have a question in a survey asking the date of the class. I have the default choice as today ${date://CurrentDate/SL} How can I create an embedded data field for the Day of the Week and Month name from this response?
Page 1 / 1
Hi
Create 2 EDs in your survey flow named selectedDay and selectedMonth and add this code to your question.
Qualtrics.SurveyEngine.addOnPageSubmit(function()
{
const date = new Date(jQuery("#"+this.questionId+" .InputText").val());
const days = 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
const months = "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
Qualtrics.SurveyEngine.setEmbeddedData('selectedDay', daysadate.getDay()]);
Qualtrics.SurveyEngine.setEmbeddedData('selectedMonth', monthstdate.getMonth()]);
});
Thank you so much!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.