How to display a form and then a thank you message in the same lightbox with a delay before close?
Disclaimer: This is my first post in the community.
I have searched the community for a few hours and I can't find a post or combination of posts that get me where I want to go.
Basically, I have embedded a form on my website that I am able to display in a lightbox, I have a div that appears on submit with a Thank you message, the lightbox closes and stays on the same page and does not display on refresh for know visitors (told you I have been scouring the community threads).
My problem is that I want to delay the closing of the lightbox on form success for 3 seconds before the lightbox closes.
similar to this but in a lightbox that closes after 3 sec: https://assets.justinmind.com/support/wp-content/uploads/2014/06/Interactive-wireframes-tab-between-inputs.gif
Here is what I have so far:
MktoForms2.loadForm("//app-ab29.marketo.com", "123-ABC-123", 0000, function(form) {
var formEl = form.getFormElem()[0],
hasNotYouLink = formEl.querySelector(".mktoNotYou"),
mktoKnownVisitor = !!hasNotYouLink;
if (!mktoKnownVisitor) {
MktoForms2.lightbox(form).show();
}
form.onSuccess(function() {
document.getElementById('confirmform').style.visibility = 'visible';
setTimeout(3000);
console.log(document.getElementById('confirmform'));
return false;
});
});