Calling confirm from alert box

Hi,

I am displaying a form in an alert box . There is an option to delete the data from the alert box and I am trying to get a confirmation from the user before deleting via calling the confirm function. The confirm window however gets hidden behind the alert box. Is it possible to display the confirm window in front of the alert box?

Thanks
Al

Hi,

Please see this FR and the linked posts. I belive this is not yet possible in Anvil.

It’s a real kludge, but I do something like this in a project :

https://anvil.works/build#clone:S5XR2VQU3VW7J2LZ=NKROKX2X6RFM75QE4REDSK2X

image

Clicking Save shows :

image

A mix of hiding and showing elements in the pop up. Not very glamorous, I admit. But it does kinda work, sort a kinda :slight_smile:

1 Like

You can do this from the form that shows the alert by testing the response and then showing a separate confirmation. something like:

response = alert(content=form) 
if response == "ok":
	confirmation = confirm("are you sure?")
	if confirmation:
		do_the_thing()

And here’s an approach with alert plus popver

https://anvil.works/build#clone:NMBFMSSDIGCD7YCU=2637USGIFXSZDNAMBGNO27LJ

Ban3C95DpU

4 Likes

Now that’s MUCH better than mine!

Mine is a legacy from before popovers.