Expand my Community achievements bar.

SOLVED

DateTime Picker

Avatar

Level 4

I have an interactive form where the user has to fill in the date and time of an incident. Is there javascript or FormCalc code availabe in these forums or online that can achieve this? Or is it best to use the Date field object? That allows the user to pick a date from the dropdown, but for the time, the user would have to fill that in manually, which is an outcome I'd like to avoid, if possible. Thank you for any advice or suggestions you may have.

1 Accepted Solution

Avatar

Correct answer by
Level 2

The easiest thing for you would probably be to have them enter the date in a date picker and then the time separately. You have two opotions for the time:

1) Create a text field with a custom pattern that validates the way they enter data. You could create a default time in the format you want them to use.

2) Create drop down lists for the hours and minutes. The user selects those and then you can use JavaScript to store the values in whatever format you want.

Hope this helps!

View solution in original post

4 Replies

Avatar

Level 10

You can write script to log the date and time the form is opened or the form submitted etc..

But if the user wants to fill their own date and time then probably you need to have different controls to capture the input..

Thanks

Srini

Avatar

Level 4

Srini,

I need the latter.

But if the user wants to fill their own date and time then probably you need to have different controls to capture the input..

What controls would I need? And do I take it that one control won't do it. I'll need one for Date and a second for Time.

Avatar

Correct answer by
Level 2

The easiest thing for you would probably be to have them enter the date in a date picker and then the time separately. You have two opotions for the time:

1) Create a text field with a custom pattern that validates the way they enter data. You could create a default time in the format you want them to use.

2) Create drop down lists for the hours and minutes. The user selects those and then you can use JavaScript to store the values in whatever format you want.

Hope this helps!

Avatar

Level 4

John, thank you for your suggestions. That definitely seems to be the best approach. Thank you for your help!