Refresh after modal close?

Is it possible to force the parent page to refresh whenever a modal is closed?

1 Like

and retin what was in the search

Doesn’t involve search. List details page with buttons that open modals containing forms for various actions. Would like the main page with the details data to refresh whenever the modal is closed. As it is now, if a form is used to launch an automation that updates something on the page where the modal was launched, the user doesn’t see that it’s been updated when closing the modal because the page doesn’t refresh.

Add this to Code inside footer of the parent page, not the modal page.

It adds refresh after you click the close modal button (assumes the “Do nothing” action is set for the modal)

window.addEventListener('load', function() {
    setTimeout(function() {
        var e = document.getElementsByClassName("sw-modal-close")[0];
        e.setAttribute('onclick', "MicroModal.close('sw-modal');  location.reload();");
    }, 1600);
});
</script>

PS Some apps need a pause before reload, perhaps to wait for an Airtable automation to complete:
e.setAttribute('onclick', "MicroModal.close('sw-modal'); setTimeout(location.reload.bind(location), 1600);");

1 Like

@cooper What do you mean by “Do nothing” action? I don’t see any modal options other than size.

I meant the do nothing option on Form submit within modal. Just laying out my use case since Softr tends to vary quite a bit, impacting code example. But may be of no consequence in this case!