I need to make downloadable pdf files only for those who register on my site. I want to create a button that when clicked opens a pop up contact form. After filling in the required fields in the pop up and clicking send, a new page with the file should open.
I use WordPress to customize the site.
I created the button to open the pop up contact form using the following code:
[wpb-pcf-button id=‘13606’ text=‘download data sheet’]
I also created a contact form using the following code:
Azienda*
[text* your-company]
Email*
[email* your-email]
[submit “Scarica il PDF”]
document.addEventListener( ‘wpcf7mailsent’, function( event ) {
window.open(‘https://www.teamkabel.it/wp/wp-content/uploads/2024/07/BUS-CANBUS-BUSCAN2X2X0.25PUR.pdf’, ‘_blank’, ‘noopener, noreferrer’);
}, false );
If I click the first button it opens the pop up contact form, but if I compile the fields and click submit it doesn’t open a new tab showing the file.
I don’t know which part of the code is wrong.
Francesca Landi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.