Limit dates customer can choose from a calendar picker | XM Community
Skip to main content
Question

Limit dates customer can choose from a calendar picker

  • December 18, 2023
  • 1 reply
  • 127 views

Forum|alt.badge.img

Customers are asked to pick a date that they visited one of our venues. In most instances, they will be completing the survey on the actual date they visited (i.e. today), but we are getting a number of customers choosing ridiculous dates (i.e. either way back in the last century, or many months/years into the future), which obviously messes up the dashboards the responses feed into.

Ideally, I’d like to stop the customer from choosing a date later than the current date, & no earlier than 30 days before the current date.

The question for the calendar was created via Javascript, of which I have no knowledge of (this section was put together by a Qualtrics partner) - can anyone advise on how I can undertake the above?

 

Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+44
  • December 18, 2023

@Ajay mistry

The interface looks like flatpickr if yes you can add below lines in JavaScript and it should do the job.

Qualtrics.SurveyEngine.addOnload(function()
{
jQuery("#"+this.questionId+" .InputText").flatpickr({

    minDate: "today",
    maxDate: new Date().fp_incr(30), // 30 days from now


	});
});

But if it is something else kindly paste your code.


Leave a Reply