Showing alert message when another element is focused

Hi all. I’m building an app where users will get 100% free functionality for up to 7 days in advance. If they want to use the functionality beyond that time range they should purchase credits.
It all works very well with conditional statements, if there are no credits, the datepicker only shows the next 7 days.

What I’d like to do, however, is show an alert message when the date picker is in focus, informing the user they have no credits and suggesting they buy some.
Is there a way to show an alert message when the date picker is in focus? I see no workflows for a datepicker element.

Thanks!

Hi there, @whywork… you can do what you described by using the Do when condition is true workflow event, and you would have an action in that event that shows an alert.

Here is what the workflow event would look like.

workflow

Now, here’s the kicker… you can’t actually create the Date/TimePicker B is focused condition on the workflow event itself because is focused does not show up as one of the options. However, if you go to any element that is on the page with the date picker (maybe the alert itself), you can construct the expression on that element’s conditional tab, and then you can copy the expression into the Only when field on the workflow event. Crazy, eh?

Hope this helps.

Best…
Mike

1 Like

@mikeloc … you are revealing deep secrets about Bubble … :wink:

1 Like

Just an aside: There are other expressions like this that can be composed in one place but not in another. While in this case this looks like a bug to me, Bubble has said of other such expressions that if you can build it in one place but not in another, this “build there, paste here” is fragile and subject to breaking at any time (presumably because they really don’t support the thing you’re trying to do and may fix the “bug” that allows it). FYI!

1 Like

Thanks a lot @mikeloc, that worked like a charm! :slight_smile:

@keith Thanks for the warning, it’s good to know. I might actually used “is hovered” instead of “is focused” as that option is listed and it suits me just as well.

@cmarchan I’m trying to stay away from plugins as much as I can. I have used them in the past with WordPress and they always slowed down the performance.

2 Likes

@whywork

Staying away from plugins is a great practice.

This one may be an exception though :wink:

This topic was automatically closed after 70 days. New replies are no longer allowed.