Contact Form 7 – Additional Settings – conditional redirect values
-
Hi all,
Probably an easy question for hardcore developers, but I can’t seem to get this working.
I have a conditional redirect in place in the additional settings box of contact form 7, which in sense does work as it should, but I am trying to pull in answers provided by the user at the time and drop in to the redirect url.
Below is the code I have in the additional settings, which as I said does work and redirects to each domain correctly:
on_sent_ok: " if (document.getElementById('id1').value=='Yes') {location.replace('https://www.domain1.com&[REPcode]&[telephone]')} else { location.replace('https://www.domain2.com/thankyou') } "
So from the above, based on the question in the form with the id value of id1, if this is answered yes from the dropdown, it redirects to https://www.domain1.com&%5BREPcode%5D&%5Btelephone%5D and if answered as no redirects to https://www.domain2.com/thankyou.
In the form itself, I have forms fields with the id’s ‘REPcode’ & ‘telephone’ which I want these passed through to the [REPcode] and [telephone] sections in the additional settings to complete the URL.
As I said, this is probably a simple answer to most of you, but I’m struggling to find the answer. Any help is much appreciated.
Thanks,
- The topic ‘Contact Form 7 – Additional Settings – conditional redirect values’ is closed to new replies.