Skip Navigation

[Résolu] Post forms saved in progress / Paged forms

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:

Building Multiple Pages Form, I need to create 9 pages form. How to use this snippet in my case?

Solution:

In you case it needs at least 9 post forms + 8 content templates, for example:

https://toolset.com/forums/topic/post-forms-saved-in-progress-paged-forms-2/#post-1697739

Relevant Documentation:

https://toolset.com/documentation/programmer-reference/cred-api/#cred_success_redirect

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.

This topic contains 4 réponses, has 2 voix.

Last updated by hansooH Il y a 1 an et 4 mois.

Assigned support staff: Luo Yang.

Auteur
Publications
#1697009

Tell us what you are trying to do?
- Building Multiple Pages Form

Is there any documentation that you are following?
https://toolset.com/forums/topic/post-forms-saved-in-progress-paged-forms/page/2/#post-1697007

Christian,
I need to create 9 pages form. How to use this snippet in my case?
I've had success redirecting from the first form to the second form.
However, I am not sure how to redirect the second form to the third form. Can you tell me this code?

#1697739

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hello,

In you case it needs at least 9 post forms + 8 content templates:
- The first post form for creating new post
- Other 8 post forms for editing post

Put above 8 editing post form into different content template, one content template one editing post form, for example:
- Create a page display the first post form for creating new post(form exmaple, the creating new post form's ID is 10)
- Content template "Step 2"( ID: 21), display editing post form "Step 2"(ID: 11)
- Content template "Step 3"( ID: 22), display editing post form "Step 3"(ID: 12)
...

you can setup your PHP codes like these:

add_filter('cred_success_redirect', 'stegvis_skjema_el_test',10,3);
function stegvis_skjema_el_test($url, $post_id, $form_data)
{
	if ($form_data['id']==10) // step 1 form ID
	{
		$arr = array('content-template-id'=>21); //the step 2 content template ID
		$url = add_query_arg($arr, $url);
	}
	if ($form_data['id']==11) // step 2 form ID
	{
		$arr = array('content-template-id'=>22); //the step 3 content template ID
		$url = add_query_arg($arr, $url);
	}
	if ($form_data['id']==12) // step 3 form ID
	{
		$arr = array('content-template-id'=>23); //the step 4 content template ID
		$url = add_query_arg($arr, $url);
	}
	return $url;
}

More help:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_success_redirect

#1704635

My issue is resolved now. It works thank you so much 🙂

#1704761

Hi, I have one more question.
I have two multiple page forms.
The first form works great. When I make the second form, what should I change variables or name?
For example,

This is the first form code,
add_filter('cred_success_redirect', 'stegvis_skjema_el_test',10,3);
function stegvis_skjema_el_test($url, $post_id, $form_data)

the second form
add_filter('cred_success_redirect', 'stegvis_skjema_el_test2',10,3);
function stegvis_skjema_el_test2($url, $post_id, $form_data)

Is this correct? Should I change anything else?

#1704791

My issue is resolved now. Thank you!