Close Modal after record update

You can simply add a static block in the modal page, below the form.
Write a text like “Please wait… The modal will close shortly”

Let’s say the id of this new static block is #cta1.
You would have to add this in the header custom code of the modal page:

<style>
#cta1 {
    display: none;
}
</style>

Then update the script I gave you for the modal page like this:

<script>
window.addEventListener('block-loaded-form1', () => {
 window.addEventListener('submit-form-success-form1', () => {
   document.getElementById('cta1').style.display = 'block';
   document.getElementById('form1').style.display = 'none';

   setTimeout(() => {
     window.parent.dispatchEvent(new CustomEvent('reload-block-list1'));
     window.parent.dispatchEvent(new CustomEvent('reload-block-list2'));
   }, 3000);
 });
});
</script>

It should do the trick

1 Like