Clear Datastore on Page Unload

Hey all, I’ve been racking my brain over this for way too long.

I have a multipart form on a separate page (because I already have too many modals :rofl:) and I cannot for the life of me figure out how to clear the datastore I have on page unload.

The reason being is that my data is structured for families (parent table) with 5 child and grandchild tables for students, guardian, emails, phones and addresses. I REALLY don’t want write to DB each step, then have to delete. Although I understand this may be the best move if I can’t clear my datastore on unload. My foreign keys are set correctly to cascade on delete so that’s not a huge issue.

window.addEventListener(‘beforeunload’, function (e) {
e.preventDefault();
e.returnValue = ‘’;
});

Thanks in advance for any advice.

Cheers
Michael

Community Page
Last updated: