Forum Academy Marketplace Showcase Pricing Features

Why won't date picker set value on page load?

I’m trying to understand the behaviour of a dropdown box and date picker I have set up.

I have a date picker, with the initial content set to the current date/time hours and minutes changed to 0

I then have a dropdown which I want to display a list of Flights, with a Flight Date of the value of the Date Picker. In the DB, all flight dates are formatted to be hours and minutes changed to 0 upon their creation, so these values should match.

When the page loads, the date picker is displaying today’s date, as it should be, but the dropdown does not display the content.

If I choose another date, then the list of flights shows up. It won’t load them initially when the page loads though.

Why is it not autopopulating the dropdown when the page loads or setting the value of the date picker?

Even when setting the Default Value of the dropdown to specifically be a search for the first item of the matching flights of the date picker’s value, it still doesn’t show it until I actually pick a date manually, despite the date picker showing today’s date in it.

It’s like the date picker’s value isn’t actually “Set” until I pick it, despite telling it’s initial value to be today’s date. Why??

So, once again I solved my own problem :smiley:

I always make a post once I begin to become frustrated with why something doesn’t work, then find the solution before someone replies.

I saw in the docs,

Tip: If you select date-only for your Date-Time picker, choose an initial content that does not include a time. If you use Current date/time instead, filters based on this initial content may filter out new data where date is still Current Date but after Current Time.

This had me thinking about how the date was being created. I was creating the date by saying “today’s date, hours set to 0 minutes set to 0”

Since that says choose an initial content that does not include a time, I thought well, how do I do that? The date field in the DB has an associated time. It’s just built into the “date” data type, however, you CAN choose “round down to day” when creating and filtering

image
image

Now when the page loads, the list in the dropdown loads as well!!

So, keep this in mind. It seems like any lists relying on a date might not work right if they don’t use a specified time or aren’t created in the right way.

When I look at the data in the DB, these both create the same entry. <today’s date> 12:00 am

But I guess the way they’re being created by bubble matters.

1 Like