Disable DatePicker "Apply" button until a change is made

When clicking a DatePicker (with pick_time set to True) that already has a date value (so that the component is being used to edit a value rather than set an initial value), I’d like the “Apply” button to be disabled until a change has been made (to either time or date). Otherwise, you can get situations like this, where someone changes the year dropdown (without then clicking a day number) and may click “Apply” thinking that will change the year, whereas it will actually have no effect:

I just spent 30 minutes or so debugging my code to figure out why changing the year wasn’t effecting the date, only to finally realize that I needed to click a day number in the new month/year to have the date change take effect. The enabled “Apply” button was misleading me.

Simple demo here: Anvil | Login

5 Likes

The user needs to

This bites me a lot. As a programmer, I tend to forgive and forget these things.

As a UI builder and designer, however, I’ll be the one getting calls from users who say “Yes, I changed the year, but it didn’t save my change! Shame on you! That’s your fault! Fix it!”

In many of my use-cases, the user can be expected to have to change only the year. So this will bite a lot of people.

I would go so far as to display the original value and the “proposed” value cleanly, e.g., in ISO format (or a more familiar national format of my choosing), one above the other, so that users can readily see exactly what change they’re APPLYing.

Now, we can create custom widgets to do things like that. But we can’t force our Dependencies to use them. So it’s probably best to make the core, shared widgets as user-friendly as is feasible.

And having such odd behaviors, with no instructions, warning or explanation, is anything but user-friendly.

5 Likes

I’ve been bitten too: Error changing the year in the date picker

5 Likes