We are asking respondents to let us know what time of day they do certain things and we therefore want them to input the hour and minutes for each item.
We'd rather not leave this to an open-text answer, and are currently torn on the best way to handle this from both a respondent and data analysis perspective.
Thanks in advance for any help you can provide!
Steve
!
The expression you'll want to put in is as follows:
`^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$`
This is a complicated topic, but regular expressions checks to see if the values match a specific pattern as above.
Another cool thing you can do is use jquery and the Modernizr library to try and detect if the device is mobile and if it is, trigger the native time pickers.
Can you provide an example? or further guidance on how to implement this? Thanks!
> You may want to use javascript to trigger a time picker. I have used this one before: amsul.ca/pickadate.js/time/
>
> Another cool thing you can do is use jquery and the Modernizr library to try and detect if the device is mobile and if it is, trigger the native time pickers.
@RTSullivan - that's exactly what I need to do for my survey. Thanks for the sample code (from amsul.ca/pickadate.js/time/). I am a novice and tried using this code (copied and pasted as-is into Qualtrics) but keep getting the error "Invalid JavaScript! You cannot save until you fix all errors: Unexpected token :"
Can you provide an example? or further guidance on how to implement this? Thanks!
> RTSullivan - that's exactly what I need to do for my survey. Thanks for the sample code (from amsul.ca/pickadate.js/time/). I am a novice and tried using this code (copied and pasted as-is into Qualtrics) but keep getting the error "Invalid JavaScript! You cannot save until you fix all errors: Unexpected token :"
>
> Can you provide an example? or further guidance on how to implement this? Thanks!
2klcar_dart - That is a JavaScript syntax error. It is seeing a colon where it shouldn't. Maybe you have a colon where you should have a semi-colon. Other causes could be mismatched quotes, a missing paren, etc. You can comment out portions of your code between /* and */ to narrow down the location of the issue.
> > @klcar_dart said:
> > RTSullivan - that's exactly what I need to do for my survey. Thanks for the sample code (from amsul.ca/pickadate.js/time/). I am a novice and tried using this code (copied and pasted as-is into Qualtrics) but keep getting the error "Invalid JavaScript! You cannot save until you fix all errors: Unexpected token :"
> >
> > Can you provide an example? or further guidance on how to implement this? Thanks!
>
> 2klcar_dart - That is a JavaScript syntax error. It is seeing a colon where it shouldn't. Maybe you have a colon where you should have a semi-colon. Other causes could be mismatched quotes, a missing paren, etc. You can comment out portions of your code between /* and */ to narrow down the location of the issue.
Thanks for the tip, @TomG! I was able to eliminate the error message by changing all of the commas to semi-colons, but the feature I'm trying to achieve still wont work / doesn't appear when I preview the survey. I think I'm stuck on step zero (http://amsul.ca/pickadate.js/time/) "The basic setup requires targeting an input element and invoking the picker." I'm not sure where in Qualtrics to specify this code: $('.timepicker').pickatime().
I should reiterate I am very much a novice, and greatly appreciate your help!
```
jQuery("#"+this.questionId+" .InputText").pickatime();
```
https://community.qualtrics.com/XMcommunity/discussion/comment/5048#Comment_5048Hi Tom,
I am a complete novice in JS and a beginner in Qualtrics. would it be possible to post a .qsf of the time picker you have mentioned?
https://community.qualtrics.com/XMcommunity/discussion/comment/43450#Comment_43450I've never used the pickatime library referred to above. I recommend flatpickr for date and time picking. Here is a post on integrating it.
https://community.qualtrics.com/XMcommunity/discussion/comment/43450#Comment_43450I've never used the pickatime library referred to above. I recommend flatpickr for date and time picking. Here is a post on integrating it.
Trying to learn how to integrate cleave.js or flatpickr into my surveys.
@MMLab,
Links to old posts were messed up when Qualtrics switched to a different Community platform.
Here are a couple of posts that have what you are looking for:
Flatpickr:
Cleave:
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.