I am creating a Website in WordPress using Contact Form 7. In my site I have several documents on different pages. In order to access those documents, first the user has to fill out a form and then he/she will receive a mail with a link to access that PDF.
My Question is - how can I redirect the form after successful submission to the original page and please remember that I have different pages and all of them are using the same form...
|
|
||||
|
|
|
In Contact Form 7 below each form there would be an Additional Settings metabox. You could redirect the form to a particular page after successful submission by putting the following in the Additional Settings metabox.
|
|||
|
|
The way I do this on a few client sides is adding a Javascript function and referencing this in the settings metabox like this:
And then I add this JS function to the themes_header. This could include any logic you want like
You could also easily use this to pass a value generated in PHP:
But be aware that the whole "on_sent_ok" stuff only works on AJAX submit. If JS is disabled and the form is submitted via $_POST the redirect doesn't work. |
|||
|
|