Problem: I have two Forms. When one Form is submitted, I would like to redirect the User to the second Form, but I would like to add a URL parameter based on the selections in Form 1. That URL parameter should be used to preselect one of the fields in Form 2.
Solution: The cred_field shortcode accepts an attribute called "urlparam" that you can use to pre-define field values. For example:
[cred_field field="mobile" post="agent" urlparam="mobilenum"]
Then in the URL:
http://yoursite.com/form-page?mobilenum=123-456-7890
To set a URL parameter value in the redirect URL based on a custom field selection, use the cred_success_redirect API:
add_filter('cred_success_redirect', 'custom_purchase_redirect',10,3); function custom_purchase_redirect($url, $post_id, $form_data) { if ($form_data['id']==12345) { $email = get_post_meta( $post_id, 'wpcf-e-mail', true ); $phone = get_post_meta( $post_id, 'wpcf-telefonni-cislo', true); $redirect = $url . "?fapi-form-email=" . $email . "&fapi-form-phone=" . $phone; return $redirect; } return $url; }
Relevant Documentation:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 4 replies, has 2 voices.
Last updated by 6 years, 4 months ago.
Assisted by: Christian Cox.