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?
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
My issue is resolved now. It works thank you so much 🙂
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?
My issue is resolved now. Thank you!