I want to redirect after the form is submitted anything that has not the id contact-370
to a remote URL. The issue right now is that the contact form is also redirecting and it shouldn’t.
document.addEventListener('wpcf7mailsent', function (event) {
if ('contact-370' !== event.detail.contactFormId) {
var newTab = window.open('', '_blank');
newTab.location.href = 'https://mycoolurl.com/';
}
}, false);
https://contactform7.com/redirecting-to-another-url-after-submissions/
I’m using the latest version of Contact Form 7, so on_sent_ok
and on_submit
are deprecated. What am I doing wrong? I’m open to a different solution. Thanks.
3
Answers
For now, I just got rid of the
if
and placed the script on Register and Volunteers, and is working as it should. It's ugly but it works.To integrate safely with stripe.com can be an intricate programming task. I respectfully suggest you use some tested plugin unless you have Javascript and HTML skillz, knowledge of how to repel cybercriminals, and some time to develop and test your stuff. CF7 has a stripe.com addon plugin.
Seriously. I know this isn’t an answer to your question. But I’ve been through really detailed audits (to Payment Card Industry Standards) and it saved us an unbelievable amount of auditor trouble when we were able to say "we use stripe.com’s APIs for payment". Don’t DIY the use of those APIs.
The page you reference is form ID 330 it appears.
Your code should be this then.