Date Pickers

I have 2 date pickers on a form. How can I default the second date picker to the date that has been selected in the first date picker?

I assume you have two Date & Time columns in your data table to support the two distinct dates. If so, set the Default value of the second date picker to the value of the data in the column of the first date picker.

Default Value

There are 2 columns however, the first would need to be submitted in order for that to validate.
What I want it is a form with 2 date pickers. The user selects a date and time on the first field. If they then select a different date on the second field, they get a warning saying that the dates must be the same.

Oh, I see. You need something like a field level action that would populate the second date field after filling in the first one on the current form (and before the Submit button is pressed). Not sure about that one since I don’t think we have field level conditional actions just yet. Maybe one of our Glide Experts has a solution.

So your 2 date pickers must have the same value? Why wouldn’t you just have one, and then use an on-submit action to set the first date to the second date?

1 Like

Indeed. Or why even bother with the second date column at all? :thinking:

1 Like

Hmmm…if you are picking a vacation in the future (a few months from now) then maybe you want the second date close to the first date and not have to re-enter/scroll through the months to get to the second date. The first date is the start date and the second date is the end date.


That would only make sense with the original post.

Does not make sense with this.

Apologies I should’ve been clearer in my original question. Both fields are date and time pickers. The times must be different in both but the dates must be the same.

ah, that makes more sense.

A couple of questions for you:

  • Are you open to a solution that uses a Custom Form? It’s a little bit of work to set up, but can provide a nicer user experience, as well as the validation that you’re looking for.
  • Is there a range for the times (example 7am to 7pm), or could they be any times within the 24 hour period?
  • Does the user need to enter the times to the exact minute, or could it be a selection from (for example) 10 or 15 minute blocks?
  • Presumably the second time must be later than the first time?

Thanks for responding.

I am open to using a custom form. I have looked for some tutorials on this but must admit, I’m a bit lost.
At the moment, the time is selected using the clock dials on the picker however, I do think it would look better if I could present a dropdown of times (say 07:00 - 18:00 in 15 minute intervals). I still need to calculate the total time between both sets of data though as I’m using this to calculate pay based on an hourly rate if that makes sense.

And yes, the second time should later than the first.

What plan are you on at the moment? There’s a possibility to use the native form plus CSS to block the submit button if the validation doesn’t return true.

I’m on the free plan at the moment.

Hey, sorry for not getting back to you. I have a solution in mind, but it’s a little complicated to setup so I was intending to make a short video for you. If you can wait for a bit, I’ll get that done tonight or tomorrow.

So, you mean that both columns must have the same date, but the times can be different, where the time in the second column must be later than the time in the first column?

Thanks Darren. I would appreciate that.

We are all waiting with bated breath :slightly_smiling_face:

Don’t get too distracted watching Shane Lowry!

Thanks for all you contribute.

Below is a link to a Concept App Template that demonstrates the solution that I had in mind. You can copy it and study it to see how it works. Note that it assumes that the user will always be signed in.

Essentially it uses a Helper Table to construct a list of Times to use in two choice components, which are presented in a custom form, with appropriate validation applied.

1 Like

This looks very close to what I was originally trying to achieve Darren.
Thank you for that. I will inspect the logic tomorrow.

When I try to add an entry, it does work however, I also get an error. Not sure why.

It won’t work if you’re viewing as a template, because it requires a signed in user. But if you copy it, add a user to the users table, then view as that user, it will work.

1 Like