I have a form and below the form a table component.
Adding is simple and you get a success message: great!
The table updates itself, so no manual reload necessary: even better!
But if you want to add other points to the list, it is not clear whether it was already saved or not because the success message does not vanish.
Could you make a vanish/fade action for the success message?
Very interesting request. I can see the use case and we’ll discuss internally.
For now, if you want something you can implement right away, you can do the following code in the footer of your app.
<script>
function waitForElm(selector) {
return new Promise(resolve => {
if (document.querySelector(selector)) {
return resolve(document.querySelector(selector));
}
const observer = new MutationObserver(mutations => {
if (document.querySelector(selector)) {
resolve(document.querySelector(selector));
observer.disconnect();
}
});
observer.observe(document.body, {
childList: true,
subtree: true
});
});
}
waitForElm('.form-process-message').then((elm) => {
$('.form-process-message').delay(5000).fadeOut('slow');
});
</script>
If you want to only have this happen on specific pages, remove the last 3 lines from here and put it in the Javascript of the pages you wish for this to be triggered on.
I also tried it all on the concerned page only, and third option was what you adviced before: so the upper part in the footer and the bottom 3 lines in the Javascript of the page (without the script tags)