Reading A Database List Within A Conditional

Hello All,

This post is related to the “conditional” tab in conjunction with a database list.

My signup page has three dropdowns for the user to enter his/her birthday—one dropdown each for day, month, and year.

To make sure that the user-selected birthdays are valid I specified a few conditionals. For instance, if a user selects day “31” the next dropdown will only show those months that have 31 days (January, March, May, etc.). If a user selects the month of February in conjunction with a leap year, the day selection dropdown will include day “29”, otherwise the usual 28 days.

I was hoping to do the conditional involving the leap years in one go. I have a database list containing 27 leap years ranging from 1917 to 2024.

Originally, the idea was to implement it as follows » If dropdown month’s value is “February” and dropdown year’s value is [ —> do a search for leap years list in the database ], then include day “29”.

Unfortunately, this only seems to work, if I point to a single “:item #” in the database list, not with multiple “:items” such as “:items until #” or “:items from #”. So, I ended up copying and pasting the conditional 27 times. It does the job, but it’s not very elegant.

Although Bubble gives me the option to select “:items from #” or “:items until #”, only the single solution works.

Is this a bug?

Thank you for sharing your views.

If you use the DateTime Picker and click “Display dropdowns to pick month year” you can probably eliminate all the conditional code.

Update
I just added the DateTime Picker element to an app form, clicked the option, clicked Preview and tried it. For some bizarre reason, the years only go back to 1991. However if you click on 1991 in the drop down, you can see years before 1991 but only back to 1972. If you click on that you can get to earlier years. There may be some way around this. Worth looking for to avoid having to do date validation yourself.

Hi alan5,

Thank you very much for your quick reply and for testing the DateTime Picker. I have deliberately not selected the Picker because I don’t think it offers a good UX experience and because I like to have more control over UI.

The behavior you described is indeed bizarre.