Allow single field across multiple pages of form

Any thoughts on how I might allow a single field (actually two single fields) of a form appear across multiple pages of a form?

My use-case is that I’d like to add Gravity PDF Previewer to a multi-page form. At the beginning of the form, I allow users to enable/disable the previewer. Many users will be on a slow internet connection, so I need to give them this option. I’d like this toggle available at the top of each page. Additionally, I’d like the PDF Previewer field inserted at the bottom of each page.

Is there maybe some page filter that could be used to render (or mirror) these fields into the page content? TIA for any help in getting me to the right place!

I’ve pulled together a solution for this. I’ll try to get around to sharing sometime.

I’d like to see it!

Here you go. I don’t expect there should be much conflict (if any) with extensions or third-party plugins. I’ve tested on a site that’s loaded with quite a few GF add-ons and all seems well.

Blog Post Explaining Use
https://typewheel.xyz/show-fields-across-multiple-pages-gravity-form

The Snippet

<?php // Prepends or appends fields (marked by class `prepend-to-page` or `append-to-page` respectively) to every page of a Gravity Form
add_action( 'gform_pre_render', function( $form ) {

   add_action( 'wp_footer', function () { ?>

      <script type="text/javascript">
         jQuery(document).bind('gform_post_render', function(event, form_id, current_page) {

            jQuery(jQuery('.gfield.prepend-to-pages').get().reverse()).each(function() {
               jQuery(this).prependTo(`#gform_page_${form_id}_${current_page} .gform_fields`);
            });

            jQuery(jQuery('.gfield.append-to-pages').get().reverse()).each(function() {
               jQuery(this).appendTo(`#gform_page_${form_id}_${current_page} .gform_fields`);
            });

         } );
      </script>

   <?php } );

   return $form;

} );
1 Like

It might not be what you are after, but I developed a simple solution to re-using the same field (same admin label) across multiple forms. It pre-populates its last entered value at each rendering. It also adds merge tag support of the field’s saved data.

© 2008 - 2019. Gravity Forms is a project by Rocketgenius Inc.