Reputation: 33
As of now, I have tried doing this
<label>
[email* your-email default:get id:textarea placeholder "Email address"] </label>
<div style="text-align: center;">[submit id:button "Get started now"]</div>
add_action( 'wp_footer', ’redirect_to_new page’);
function ’redirect_to_new page() {
?>
<script type="text/javascript">
document.addEventListener( 'wpcf7mailsent', function( event ) {
If ( '2023' == event.detail.contactFormId ) {
location = 'https://app.techinme.com/#/registration?email=[your-email]’;
}
}, false );
</script>
<?PHP
}
when the user clicks on submit button on the form they are directed to the new page but I am unable to populate the email ID in the new form present in the new page. Can someone please guide me further?
Cheers!
Upvotes: 0
Views: 1068
Reputation: 2338
This is not tested but should get you going in the right direction.... Below I updated your code to grab the email from the form and append it to the location
url:
<?php
add_action( 'wp_footer', 'redirect_to_new_page');
function redirect_to_new_page() {
?>
<script type="text/javascript">
document.addEventListener( 'wpcf7mailsent', function( event ) {
if ( '2023' == event.detail.contactFormId ) {
// get email
var email = event.detail.inputs.filter(function(item){
return item.name === 'your-email';
})[0].value;
location = 'https://app.techinme.com/#/registration?email=' + email;
}
}, false );
</script>
<?php
}
Upvotes: 2