Dynamic URL to redirect after submission based on processed input data
-
So far I cannot achieve this.
To use:
document.addEventListener( 'wpcf7mailsent', function( event ) { location = '.....' })
the event object needs include information about the URL.
The URL must be determined at PHP side after processing user input (basically email address). Then I would need to modify REST feedback to include that URL and access this value in JavaScript.
The problem is that within this hook:
$response = apply_filters( 'wpcf7_feedback_response', $response, $result );
I cannot access submitted form values to pick the email address and do the processing stuff to drop the URL into $response array.
Then I tried to go deeper into WPCF7_ContactForm’s submit() method attempting to pass some data through $result variable it returns. Unfortunately, it is not possible to modify this variable.
So my question is, if there is a better way to comply this task?
Alternatively, could you (developers) add filter hook allowing to modify $result variable of submit() method? The filter having access to $submission data would allow to create custom results based on submitted data (like dynamic URL for redirect).
It could look like:
$result = apply_filters( ‘wpcf7_submit_result’, $result, $this, $submission );
- The topic ‘Dynamic URL to redirect after submission based on processed input data’ is closed to new replies.