<script>
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>
To be inserted in the footer code of the page settings (in the page where the modal is open when you click on a list item). When closing the modal with the close button, it should reload the page.
Good morning, here is your annoying reminder that setting a single timeout is going to create random hard-to-diagnose problems for your users who might be on a slower computer or just having intermittent network connectivity problems.
Instead, it’s better to use setInterval() with a test to see if the condition you’re waiting for has in fact occurred, and then clearInterval() to cancel the timer.
I have tried, but there is not effect at all, just like Matthiew said, I put it on the list page, where the modal would be triggered. Here enclose the pict showing how I put it on the customs code:
I have just been aware that after pressing the X button on the upper right hand corner, after closure of the modal page, the master page refresh automatically. Therefore, the code seems to be effective in a way, but not totally.
Probably, there is something missing to really kick off the first part of the code.
@Viktoria Could you please kindly check with your technical team and ask for their advice, how the code should be adjusted in order to be effective with the modal page. I think this small enhancement could help a lot of users to create a better customer journey. Appreciate your kind assistance as usual
Hi @twmeric
As Matthieu mentioned, would you mind sharing the link to the List block page of Published app, so I could review the custom code with the tech team?
The after closure refresh is performing just like what I want it to be, it refreshes and goes back to the particular position of the page so user don’t need to scroll.
Therefore, what I miss is the closure of the modal page, where there should be two things happen upon pressing it:
send out data to airtable (as it always does)
close itself 2 seconds after showing the green wordings which indicates a successful update
I wonder if the highlighted part need to be addressed with some codes.
Hope the above details would help working out the viable code which should enhance user experience a lot - a few lines of code can make a huge difference. Nice weekend!
@flavi Just to be sure, you want the page to refresh after clicking on this X button (the close button) or after a form submission? If after a form submission: just do exactly like I wrote above.
If it’s on close modal action (so with the X button), I dont have any solution and I won’t do it (I realize there is no sense to have such action)