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 ) 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.
-
I’ve tried adding
dmx.parse('datastore.clear()')
on a hunch, but get "Cannot read properties of undefined (reading ‘get’)" -
I can’t get my windows.addEventListener to fire on unload at all. Yet the script at the bottom of my page to confirm leaving the page works a treat:
window.addEventListener(‘beforeunload’, function (e) {
e.preventDefault();
e.returnValue = ‘’;
});
Thanks in advance for any advice.
Cheers
Michael
Last updated: