I have to have a form refreshed after it’s sent. Let’s say after 3 seconds. So the situation looks like this:
user type something on form
user hit submit
user get success/fail message
after 3 seconds form is refreshed (or any of my scripts are run)
I’ve tried using an onclick="setTimeout(function() { refreshform() }, 3000); while the refreshform() function looks like this:
function refreshform() {
$('#wf-form--2').css('display: block;');
$('.w-form-done').css('display: none;');
$('.w-form-fail').css('display: none;');
}
just so I could get back to the form inputs again. It didn’t work, so I tried using $('hitsubmit').click(); to setTimeout once the submit is clicked, but the event ran before the success message appeared causing it to overwrite my function.
Is there any way I could catch the “success/fail” event of the form? I need to have my form refreshed to its original state after a success message. I really need your help guys. Maybe @danro or @callmevlad could help me out with that? ;)
Here is the situation: I have a website where you choose product from a list and you get a form in which you can order this product. The form is automatically adding a product name when you hit the button on product list. Now, the form popups up, you fill your name and phone number. Once you click the submit button you get the success message and you can close the form. You can then choose another product and you will get the same form popup again, but it contains the success message instead of the form itself…
In the meantime I got an idea which might work. I’ll simply change the form success/fail message and form’s display parameter once the button is clicked. That might work.
But… I still think there should be a way to reset forms or “catch” a success message somehow using my beloved jQuery. (You wish to see things I’ve recently did using Webflow and jQuery ^^). I tried to catch ajax:complete but with no luck.
I agree. It would be nice for the form to refresh after it is sent as suggested above.
I use the following code on my Wordpress site running Contact Form 7. It will perform a slow fadeout of the “success” pop-up after 4 seconds then reset and clear the form.