How can a participant enter clock times without typing in text boxes? | XM Community
Skip to main content

Hello! I have searched and uncovered some information that I can't make work (Flatpickr?).
The situation is that I need to ask employees about start and end time availability outside of regular shift hours. So they need to be able to say, "I'm available from x time to y time" for each weekday as needed. I have constructed this with text entry boxes - doable but annoying. I've tried a drill down (didn't work out) and played with sliders but the times have to be specific (15 minute increments).
I am going to need a step by step guide if we are involving JS. I've found the Flatpickr information but the steps presented don't work. Anything I put in 'Source' view ends up text in a question box. I don't know JS well enough to figure things out when they break significantly.
I am hoping to put in two dropdowns, one for start time, one for end time but I can't figure out how to make that happen in one question.
Thanks for your ideas!

katrob63 I've linked up a document with the JavaScript code you want to insert in your survey. The question type you'll want to use is a form with the Start and End time as the two fields. This will allow them to pick a time and also ensures that their end time is after their start time.


https://community.qualtrics.com/XMcommunity/discussion/comment/44654#Comment_44654Thank you so much! Speedy and amazing!
I see in the code that there is a line to add to the header. I am not sure how or where to do that in Qualtrics. I've set up the form fields and used the Javascript option to add the bulk of the code.
I really appreciate your help!


katrob63 To access the header section, go to the "Look and Feel" settings of the survey. (See screenshot below)
Edit_Survey___Qualtrics_Experience_Management.png


https://community.qualtrics.com/XMcommunity/discussion/comment/44654#Comment_44654I think I found the header! Thank you again for everything.


https://community.qualtrics.com/XMcommunity/discussion/comment/44660#Comment_44660Thank you again and again!
I have another question since you guided me through my initial problem. Will that same script work using a side by side question that mixes radio buttons and text fields? Or are those flat text fields rather than form fields?


katrob63 As long as you only have one column of text entry, the JavaScript will work the same on a side by side as it does in the form question. If you have multiple text entry fields, all of them will be transformed to time picker and you'll lose the start time must precede end time functionality.


@jmborzick thank you so much for your custom code for the times! I have 2 questions about the way it is displaying in Preview if you might be so kind to help me if you can. 

  1. When I preview just the question, it shows the start and end time entry fields with the dropdown but then after it’s selected, it displays as military time. Any idea how to make it show regular time?

     

  2. However, when I preview the entire survey (as opposed to just the question), it will not show any time options, just blank boxes that you can type into. 

    I am not sure if this is because there is a loop and merge connected to the block for recurring entries (which is necessary for my survey)…? Any advice on any of this would be greatly appreciated!!


@KristalP To change it from Military time to standard AM/PM time change the following in the code:

 

dateFormat: “H:i”   to dateFormat: “h:i K”

 

As far as the loop and merge problem, I just tried it myself and I can’t make it work either. The code must need to be modified in someway to accommodate loop and merge but I don’t have the skill set to do that. I would create a new question and flag it for JavaScript. There are a number of community members who are skilled in JavaScript that will hopefully be able to help. 


Thank you so much for the advice! I will try the new question with JavaScript flag. Thanks again for your time and help!


Leave a Reply