Year only Calendar | XM Community
Skip to main content

Hi,
I have a Year of Birth question. I do not want a drop-down list, instead I want one of those tiny calendars to popup when the respondent clicks on the text-box. I used flatpickr (code copied below), obviously something is wrong because the calendar doesn't show. I am no expert in coding and scripting, I hope someone in the community can help. Thanks a lot, I really appreciate the help!


Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
 var input = jQuery("#"+this.questionId+" .InputText");
  input.attr("placeholder", "YYYY");
  input.flatpickr({
    dateFormat: "Y",
    minDate: "1900",
    maxDate: "${date://CurrentDate/Y}"
  });
});

Hi ALX, I have an alternative solution for this. Instead of adding text box question type in your survey just add text/graphic question. then insert the below html/javascript code to your question text in HTML section as shown below in the screenshot. Also, create an embedded variable "date" in the start of survey flow section to view and export the data.

Please let me know af any difficuly here.

What is your dob?

 
 
  Datepicker
 
 
  ">https://code.jquery.com/jquery-1.12.4.js">
  ">https://code.jquery.com/ui/1.12.1/jquery-ui.js">
 


Date:



ss.jpg


Yash , thanks a lot! But, there is a slight issue. This calendar goes back to only March 2020. And, I am looking only for Year of Birth, I do not want DOB.


Implementation of flat pick - here


Leave a Reply