PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

skip to second page when page 1 is dynamically populated

  1. Richard Vav
    Administrator

    I have setup a multi-page form which is working great http://www.eandhbaxendale.com/online-enquiries/trussed-rafter-enquiry/truss-type-enquiry/ on the first page I have a multiple choice field from which the user can select one of four product types before progressing to the next page, it also has dynamic population enabled. So if any visitor enters using an old forms url (http://www.eandhbaxendale.com/online-enquiries/trussed-rafter-enquiry/) they are presented with the same four product types which when clicked take them to the new form and populate the multi choice field using the query string method.

    What I am hoping is that there is a way to progress to the forms second page automatically if the user has entered using the image links on the old url rather than them having to see the same choices again, albeit their choice already selected, and them having to press next.

    Posted 7 years ago on Tuesday July 26, 2011 | Permalink
  2. The only way to do this right now is using jQuery to emulate a click on the Next button.
    It works fine, but you may be able to see the first page briefly before the second page is loaded.
    Try it out and see if it is good enough for you. Place the following code snippet in your theme's function.php file.

    add_filter("gform_pre_render_6", "maybe_skip_first_page");
    
    function maybe_skip_first_page($form){
    
        if(!rgempty("trusstype", $_GET) && empty($_POST)){
            ?>
            <script type="text/javascript">
                jQuery(document).ready(function(){
                    jQuery(jQuery(".gform_next_button")[0]).trigger('click');
                });
            </script>
            <?php
        }
    
        return $form;
    }
    Posted 7 years ago on Wednesday July 27, 2011 | Permalink
  3. Richard Vav
    Administrator

    Thanks Alex, that works great, as you said there is a short delay before the next page loads but that's OK.

    Thanks again.

    Posted 7 years ago on Thursday July 28, 2011 | Permalink

This topic has been resolved and has been closed to new replies.