Best way to create multi-step form with data saved to user account for later updating?

I’m attempting to set up a fairly long multi-part form (~50 questions, a few questions per page) with conditional logic. I’d like to offer registered visitors the ability to save their data between each page/step and give them the option to return later to finish.

I have Gravity Forms and thought that might work, but it sounds like this isn’t functionality they offer yet.

Read More

Does anyone have any advice/suggestions on other form plugins or code which might meet these requirements? Thanks in advance for all your help!

Related posts

Leave a Reply

1 comment

  1. If you are working on a custom theme, I believe it is easier to be done with a page template and WordPress’s wp_ajax function.

    The form can be included in the page using <?php get_template_part('form','0f-50-question') ?>.

    Here is the pseudo code for the form

    <form id="quite-a-long-form" action="<?php echo admin_url('admin-ajax.php'); ?>" method="post" class="form" >
        $step = $_GET['step']
        if $step = 1
            //first section of question
            echo <label>
            echo <input>
            echo <label>
            echo <input>
        else if $step = 2
            //second section of question
            echo <label>
            echo <input>
            echo <label>
            echo <input>
        else if $step = 3
            //third section of question
            echo <label>
            echo <input>
            echo <label>
            echo <input>
        // just repeat for all sections
        endif
        <input type="Submit">
        <?php wp_nonce_field('input-answer','security-code-here'); ?>
        <input name="action" value="input-answer" type="hidden">
    </form>
    

    And for the php that will process the file

    function process_add_transfer() {
        if ( empty($_POST) || !wp_verify_nonce('security-code-here','add_transfer') ) {
            echo 'You targeted the right function, but sorry, your nonce did not verify.';
            die();
        } else {
            // do your function here 
            wp_redirect($_POST['_wp_http_referer'].'?step='.$index_of_the_next step);
        }
    }
    

    Hope this help