Skip Navigation

[Resolved] Send form value between 3 pages

This support ticket is created 8 years ago. There's a good chance that you are reading advice that it now obsolete.

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 3 replies, has 2 voices.

Last updated by Minesh 7 years, 12 months ago.

Assisted by: Minesh.

Author
Posts
#391810

Send form value between 3 pages
We are having a 3 page app where we should share email value from 1st page up to 3rd page

On a a 1st page we have form that has the email input and when we submit that form it is going to the second page (with "Go to page" option). Second page has other form. So we would like to send the email value as GET variable to second page/form.

On a second page we would like to display that email address and on submit to send it to the third page form where we would like to send a thank you email to the end user.
how can we do that?

#391960

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

CRED Does not natively support "multistep or multipage" forms. I would suggest that you should try to create different CRED forms for each step. For that you need to use CRED API hooks and requires some custom code.

Please find following related tickets that will lead you to achieve your goad:
=> https://toolset.com/forums/topic/cred-forms-paginate-a-long-form/
=> https://toolset.com/forums/topic/multi-page-cred-form-or-save-button-for-long-form/#post-298832
=> https://toolset.com/forums/topic/cred-form-split-into-steps-progress-bar-and-views-in-it/

More help:
https://toolset.com/documentation/user-guides/cred-api/
http://codex.wordpress.org/Function_Reference/add_query_arg

#392223

Hi Minesh,
Thank you for your reply.

I was able to set some hard-coded values to URL variable. The problem is that none of those examples/tutorials explains how to obtain value from CDER form and then assign it to URL variable. I want to get the value from email field "wpcf-tim-hortons-email" and assign it to URL variable tim-hortons-email here:

add_filter('cred_success_redirect', 'step2_redirect_func',10,3);
function step2_redirect_func($url, $post_id, $form_data)
{

if ($form_data['id']==7)
{
$arr = array('tim-hortons-email'=>wpcf-tim-hortons-email); //the step 2 CRED form post ID
$url = add_query_arg($arr, $url);
}
return $url;
}

Thanks.

#392376

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

As explained in relevant tickets:

For the first form option " Choose what this form will do:", choose "Create content",
For other forms choose "Edit content"'

Now, as your first form is set for "create content", you can easily get custom field value stored in database using WordPress function get_post_meta() and $post_id.

For example:

$email = get_post_meta($post_id,'wpcf-tim-hortons-email', true);
$arr = array('cred-edit-form'=>8,'tim-hortons-email'=>$email); //the step 2 CRED form post ID
$url = add_query_arg($arr, $url);

I hope this solution will help you to resolve your issue.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.