Need custom date field called "Date of Supervision Log" | XM Community
Skip to main content

Hi,

Can someone help write the code needed for a date field? My question would be “Date of Supervision” and the respondent to choose a date. I tried adding a date field from “import from library” but I do not like how the question is phrased. 

 

Any help would be greatly appreciated! 

 

Hi @JRadu. I am sorry but I do not really understand your goal. Are you looking for some (technical) code or just some question phrasing?

For some code, please provide more input. For phrasing some examples:

"Please select the Date of Supervision:"
"Choose the Date of Supervision:"
"When did the supervision occur? Please select.“ 
"Please choose the date of the supervision session:"

I would always go with a clear and simple text - so option 1 or 2.


Hi - technical code, please.


@JRadu If you do not like the standard design you could try flatpickr

Put the following code in the Look & Feel → General → Header → Open the code view (<>):

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
<script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>

Afterwards, use the below code in some text entry question:

jQuery("#” + this.questionId + " .InputText").flatpickr({
dateFormat: "Y-m-d H:i",
minDate: new Date()
});

If you are facing issues, search the Community for flatpickr. There are several posts already…

Would appreciate if you mark my answer as solution if this is what you were looking for.


Leave a Reply