Skip Navigation

[Cerrado] multi page cred form or save button for long form

This support ticket is created hace 8 años, 7 meses. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Etiquetado: 

This topic contains 4 respuestas, has 3 mensajes.

Last updated by Christian Cox hace 4 años, 5 meses.

Assisted by: Beda.

Autor
Mensajes
#298579

I have a long form - so to avoid user losing filled data accidentally I would like to either:
1. Break it up into smaller part / paginate - while saving at each stage
2. Enable Auto save / save button on the long form

Could you please point me to the right documentation, and incase if requires coding kindly share detailed steps?

Cheers!

#298832

Thank you for contacting us here in the Support Forum

You could i.e. proceed as this:
(assuming you create new content with your Form)

1. create different CRED forms for each step (pagination steps)

2. For the first form option:
"Choose what this form will do:"
choose "Create content".

For the other forms choose "Edit content"

3. Insert the first CRED form (from step 1) into a page

4. For the your last CRED form, in the option:
"Select the status of content created by this form:"
choose "Published".

For the other forms choose "Draft"

3) For all forms options:
"Choose what to do after visitors submit this form:"
choose "Display the post"

4) use the CRED API filter hook

cred_success_redirect

to redirect to the next step form.

As example:
The post ID of step 1 CRED form is "4",
and step 2 CRED Form ID is 8:

add_filter('cred_success_redirect', 'step2_redirect_func',10,3);
function step2_redirect_func($url, $post_id, $form_data)
{
    if ($form_data['id']==4)
    {
        $arr = array('cred-edit-form'=>8); //the step 2 CRED form post ID
        $url = add_query_arg($arr, $url);
    }
    return $url;
}

Here is some related DOC:
https://toolset.com/documentation/user-guides/inserting-post-fields/
https://toolset.com/documentation/user-guides/creating-cred-forms/
https://toolset.com/documentation/user-guides/cred-api/#csr
http://codex.wordpress.org/Function_Reference/add_query_arg

Please let me know if you have further questions regarding the issue mentioned in this Thread
and let me know if the above solution works for you, I look forward to your reply!

Thank you

#300052

Thanks Beda.

Couple of clarifications:
1. I do not want to publish the post as it should come for moderation. How can I do this?
2. I didn't understand where and how to put the "code" you shared? (I'm a beginner)

#300107

I will answer your questions below:

1. When creating the CRED Forms, you can choose the status of the post when submitting the Form
(Published, draft, etc)
https://toolset.com/documentation/user-guides/creating-cred-forms/ > Step 3 – Choose the post type for the form

2. In your functions.php, just as posted above (the code).
You'll need to adapt it, according to your CRED Form ID's
You'll need to create as many redirects as you have Forms.

Please let me know if you have further questions regarding the issue mentioned in this Thread
and let me know if the above solution works for you, I look forward to your reply!

Thank you

#1276037

This process for this has changed recently, and the custom code above no longer works. Now instead of passing the Form ID into the redirection function, you must add the edit Form to an unassigned Content Template, and pass the Content Template ID into the redirection function. See https://toolset.com/forums/topic/post-forms-saved-in-progress-paged-forms/

El debate ‘[Cerrado] multi page cred form or save button for long form’ está cerrado y no admite más respuestas.