So I need a way to grab the values of the fields from a form that uses contact form 7 plugin, using the Additional Settings box on the admin page.
Some way to set a cookie with the field values would be great.
The form:
<label>Please type your question</label>
<fieldset class="question">
[textarea your-message id:questionmessage]
</fieldset>
<label>Name</label>
<fieldset class="name">
[text* your-name id:questionname]
</fieldset>
<label>Email</label>
<fieldset class="email">
[email* your-email id:questionemail]
</fieldset>
<label>[Submit button]</label>
<fieldset class="submit">
[submit "Send"]
</fieldset>
Additional Settings, that works so far:
on_sent_ok: "location.replace('page2');"
I’ve tried:
on_sent_ok: "setcookie('form-email',1,strtotime('+30 days'),COOKIEPATH, COOKIE_DOMAIN,false, false);setcookie('form-name',1,strtotime('+30 days'),COOKIEPATH, COOKIE_DOMAIN,false, false);location.replace('page2');"
this still sends the email correctly, but does not redirect to page2 (I know this should just set the cookie values to 1)
To Redirect properly contact form 7 please add this code.
Remember start double commas(“) -> single commas(‘) -> double commas(“) otherwise there will be error
I’ve called in the additional settings box in the admin area.
Then in the form area I’ve added some javascript to handle the form field values/cookie stuff. This probably isn’t great but it works.
Some links that helped me:
cookies in all pages
Cookies in javascript