Close alert with custom button event handler

What I’m trying to do:

This part works
Display a custom report button only when all the form elements in an alert have been correctly filled out “no whitespace, dropdowns are selected, etc…”

This part doesn’t work
Close the alert with a custom button on click event handler

What I’ve tried and what’s not working:
Trying to use event handles to close the alert that comes up, but it doesn’t seem to work… Check out the clone if you dare :slight_smile:

Clone link:
share a copy of your app

The event you are looking for is this

def button_report_click(self, **event_args):
    self.raise_event('x-close-alert')

Hey @divyeshlakhotia, thanks for the reply. I tried replacing my button handler with that x-close-alert, and didn’t get anywhere with it…

Mind sharing a clone?

Here’s a clone that demonstrates the use: Anvil | Login

2 Likes

That works! Thanks a bunch. I think the thing missing was the value = None part

self.raise_event('x-close-alert', value=None)
1 Like