Hi Rebecca,
The event listener for add record should be submit-form-success-listxx
for now, from the latest news I know (though I have to test it - UPDATE = It is indeed submit-form-success-listxx
listxx being the id/name of your block)
If you have issues to build the correct script, I can do it for you by replying here. If so, would you mind giving me the name of the block where the add record button is?
Also this block is inside a modal? You want to reload the parent page or the child page? (child page being the modal page)
Hi @matthieu_chateau thanks for your reply and offer to help! So I do have it reloading once the add record is submitted. The block and add record are in the same block and on the same page.
window.addEventListener('submit-form-success-requests-list', (e) => {
console.log('add record success', e.detail);
sessionStorage.setItem('scrollPosition', window.scrollY || window.pageYOffset);
// Trigger the page reload
window.location.reload();
});
However it’s not allowing for a delay in load. I tried this and it didn’t pause on reload
window.onload = function() {
if (sessionStorage.getItem('scrollPosition') !== null)
window.scrollTo(0, sessionStorage.getItem('scrollPosition'));
}
window.addEventListener('submit-form-success-requests-list', (e) => {
console.log('add record success', e.detail);
sessionStorage.setItem('scrollPosition', window.scrollY || window.pageYOffset);
// Trigger the page reload
setTimeout(() => {
window.location.reload();
}, 15000);
});
Thanks for your help!
Please try this one (delay of 1500 milliseconds - 1.5 seconds)
window.addEventListener('submit-form-success-requests-list', (e) => {
console.log('add record success', e.detail);
sessionStorage.setItem('scrollPosition', window.scrollY || window.pageYOffset);
setTimeout(() => {
window.location.reload();
}, 1500);
});
Or this one as I think you want to automatically scroll to the stored position
window.addEventListener('submit-form-success-requests-list', (e) => {
console.log('add record success', e.detail);
const scrollPosition = window.scrollY || window.pageYOffset;
sessionStorage.setItem('scrollPosition', scrollPosition);
setTimeout(() => {
window.scrollTo(0, scrollPosition);
window.location.reload();
}, 1500);
});
Hey Matthieu
Were the sign-in and sign-up listeners added? if so, what were they and could you update your code?
I have to check some details with the team before.
There will be a specific thread inside the guides and help section of the community.
Thank you so much Matthieu!