A closed popup is still triggering a "Leave Site?" message

I have an embedded HTML form from Eventbrite on a Popup.

However. If I close the popup (via Bubble’s Hide) the HTML still thinks the form needs filling in, so if I then navigate away from the page using an internal link I get this Chrome popup.

image

Any way to blat out the HTML when the popup is closed so it doesn’t do this?

Would adding “reset data” action for the popup solve this issue?!

1 Like

Thanks. No, tried that.

Also tried setting the HTML to blank when element is not visible.

1 Like

This may help: php - HTML forms: Prevent leave page warning pop-up and reset form? - Stack Overflow

Hmmm, thanks. That is very code-y for me.

Yes the answers my friend, are coding in the wind :laughing:
Try to relate to your Bubble knowledge of events and listener functions (workflows)

// naive approach, blows away the current stack of listeners
// Test that it doesn't impact the rest of the page including 
// reopening the popup, submitting the form, etc.
window.onbeforeunload = null;

Or if you need this …

// keep a copy of the listener before clearing it
window.mySavedBeforeUnloadListener = window.onbeforeunload;
// blow away the listeners
window.onbeforeunload = null;

// when/if the previous listener needs to be put back
// for example on popup show
window.onbeforeunload = window.mySavedBeforeUnloadListener;
1 Like

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