Gravity Wiz

Magically enhanced tutorials, snippets and plugins for Gravity Forms!

  • Gravity Perks
    • Gravity Perks
    • Tutorials & Snippets
    • About
  • Support
    • Documentation
    • Support
    • Account

Pro Tip: Skip Pages on Multi-Page Forms

Last updated February 19, 2015 | Written by David Smith 28 Comments

This snippet is specifically for developers to avoid having to submit every page of a form when debugging issues or developing very large multi-page forms. If you’re looking for a way to allow users to navigate your multi-page forms more readily, check out the Multi-page Form Navigation snippet.

I’ll admit it. I’m a bit of a Gravity Wiz. And as such, I do a good bit of testing on really long multi-page Gravity Forms. When you’ve got an eight page form and the issue you’re trying to debug is on – you guessed it! – the last page, it can be a very tedious and painful experience.

Do you know this pain of which I speak? If so, here’s a little snippet that single-handly (and quite succinctly) puts all those painful multi-page debugging memories behind you.

Download Code
<?php
/**
* Gravity Wiz // Gravity Forms // Skip Pages on Multi-Page Form
* https://gravitywiz.com/2012/05/04/pro-tip-skip-pages-on-multi-page-forms/
*/
add_filter("gform_pre_render", "gform_skip_page");
function gform_skip_page($form) {
if(!rgpost("is_submit_{$form['id']}") && rgget('form_page') && is_user_logged_in())
GFFormDisplay::$submission[$form['id']]["page_number"] = rgget('form_page');
return $form;
}
view raw gw-gravity-forms-skip-pages.php hosted with ❤ by GitHub

How do I install this?

Just copy and paste this snippet into your theme’s functions.php file.

How does it work?

To skip a page, simply append the ?form_page=2 parameter to the URL of any page on which you are displaying a Gravity Form. Update the 2 to whichever page you wish to display.

Standard usagehttp://yoursite.com/multi-page-form/?form_page=4
Used with other parametershttp://yoursite.com/?p=123&form_page=4
This snippet does a simple check to make sure the user is logged in before allowing any pages to be skipped. If you would like to lock this down so that only administrators can skip pages, let us know in the comments and we’ll be happy to demonstrate how this can be accomplished.

Summary

And there you have it! Working with multi-page forms just got a lot easier. Think of all those long forms with required fields on every page. You don’t have to shudder at the thought any more!

Did this resource help you do something awesome with Gravity Forms? Then you'll absolutely love Gravity Perks; a suite of 29+ essential add-ons for Gravity Forms with support you can count on.

  • View All Perks
  • Buy Gravity Perks

Filed Under: Snippets developer tip

Comments

  1. Jennifer says

    December 20, 2018 at 2:38 pm

    Thanks for this, it’s a HUGE help! Your snippets are invaluable!

    Reply
    • David Smith says

      December 20, 2018 at 3:44 pm

      Glad to help, Jennifer!

  2. Brent Alexander says

    July 25, 2018 at 2:25 pm

    YOU ARE MY HERO. This works flawlessly. I was about to roll it myself, but you saved me so much time!

    Reply
    • David Smith says

      July 25, 2018 at 11:25 pm

      Glad to hear it, Brent!

  3. Kashif says

    July 20, 2015 at 7:37 am

    Hi David,

    Thankyou for this great tip. I’ve fairly new to GF and been trying to accomplish something in multi-page forms. I have a form that takes in the user website address and on next button loads a page which asks additional questions. and then finally submit the form. What i’m trying to do is to send a email after the user clicks Next on the fist page with out any notification to the user. This is so so that i can capture the Website address even before the actual form is submitted. Can you or anyone reading this guide me on how to do this?

    Reply
    • David Smith says

      July 20, 2015 at 9:40 pm

      Hi Kashif, I think this might be what you’re looking for: http://travislop.es/plugins/gravity-forms-multi-page-notifications/

    • Kashif says

      July 21, 2015 at 2:50 am

      You are a live saver sir :) thank you so much!

  4. Anur says

    February 17, 2015 at 11:30 am

    Hi Great tip,may be u can help me with this I have a mutiple page form with one question per page, totalling 8 pages On the first page there an option to select your country — Norway or sweden if the person selects norway he continues as its asnwering all questions,but if he selectes sweden he jumps directly to Questions 6 and then follows 7 and 8. How do i make GF to skip some pages,conditonal logic somewhats fails here in the sense it does the questions but u get blank pages and have to click next ?? Any idea how do i go abt it ?

    Anur

    Reply
    • David Smith says

      February 17, 2015 at 5:36 pm

      Hi Anur, you can determine whether a page is skipped via the “Page Conditional Logic”: http://grab.by/ERFY

  5. Wain Watkins says

    January 20, 2015 at 9:24 pm

    The snippet to skip multi-page Gravity Forms worked for a long time, but no longer works. What’s going on?

    Reply
  6. Jackspparow says

    October 30, 2013 at 12:44 pm

    Hi, This solution is completely not working after enabling “Enable form persistence”. This persistence method is by an add on plugin: “Gravity Forms Data Persistence Add-On”

    Please provide some solution for this asap.

    Reply
    • Jackspparow says

      October 30, 2013 at 12:53 pm

      yeh..Got the solution. Need to paste your code in the plugin “Gravity Forms Data Persistence Add-On”. Go to Plugin editor of the “Gravity Forms Data Persistence Add-On”. You will see this page. gravity-forms-data-persistence-add-on/persistent_multipage_forms.php

      Just paste the code at the end and its done :)

      Thank You David for your awesome solution.

    • David Smith says

      October 31, 2013 at 7:58 am

      Glad you were able to find a solution. :)

  7. Mark says

    July 11, 2013 at 6:41 am

    David,

    You are the bomb!

    This little snippet is such a time saver. I just wish I had found this some days back. I was getting dizzy re-entering all those required fields over and over and over and ….

    Plus: Your Multi-Form Page Navigation and your Better Pre-submission Confirmation are magical together. If you can even use the word “magical” and “form” in the same breathe. I don’t know.

    Keep riding that “white horse.”

    Shouting out from New Orleans.

    Reply
    • David Smith says

      July 13, 2013 at 1:15 pm

      Really appreciate the kind words Mark! Glad you found this useful. :)

  8. David Smith says

    February 2, 2013 at 12:22 pm

    Alright party people! After much ado, I present Multi-page Form Navigation! Give it a shot and give me suggestions for improvement. :)

    Reply
  9. David says

    January 29, 2013 at 4:00 pm

    Subscribing for update to :)

    Thanks for a great post!

    Reply
  10. Dale says

    November 26, 2012 at 10:36 am

    Registering for followup comments.

    Thanks for the Pro Tip.

    Reply
  11. Terry says

    November 24, 2012 at 12:47 am

    Any update David?

    Reply
  12. Terry says

    November 18, 2012 at 10:58 pm

    Hell yea David you got my vote (excuse my language heh).

    I’ve literally begged the guys over at GF to help me with my script and they’re still scratching their heads atm.

    Good stuff man,

    Terry

    Reply
  13. Terry says

    November 18, 2012 at 6:49 pm

    What sort of cash are we talking about here David…

    I’ve worked up a java script that allows your to go between pages by applying a style to each and every button and using the hide-show method.

    Basically each page of the form is already loaded on the page so if you work some java magic you can use “conditions” to show and hide the segment of the form you wish to change. The issue with this is – well it’s buggy as all hell in IE (not so much in Chrome).

    Anyhow hit me up here or on your pre-submission page you can see my big vommit of spam this morning when I was pulling my hair out trying to figure this one out….

    Reply
    • David Smith says

      November 18, 2012 at 10:19 pm

      Hi Terry,

      I’m working on better page-navigation functionality for a client already and will be posting here soon. :)

      My comment to Mike van Hoenselaar was about his request for repeating field groups.

  14. Mike van Hoenselaar says

    November 15, 2012 at 5:48 am

    Love to see that functionality working as well. You cant do anything dynamic. Everything is static. I want to add an element on the last page that generates a list of links. It only works on $_POST. So you probably have to do a post and set a value in hidden text input.

    Another thing I would like is this:

    You have a page to add a room with furniture. I want a button that says Add another room. When clicked I get the same page as the current one but I can add new information for the bath room for instance. I can keep doing this until I decide to got to the next step.

    I solved it now just by making all the fields 10x statically on that page and work conditional magic. It is really time consuming :).

    Any ideas on this issue?

    Reply
    • David Smith says

      November 15, 2012 at 6:58 am

      Hi Mike, I am currently working on functionality that will let the user skip to any page on the form after it has been completed.

      As for your other request, this is definitely something I’d love to tackle; however, it’s a big one and will require a lot of thought and effort to implement effectively. Typically on these bigger pieces of functionality, I wait until a user/client is able to help fund the development before I dive in. With that said, if you or any other user reading this would like to fund such a feature, let me know. :)

  15. Justin Kunst says

    November 2, 2012 at 3:39 pm

    Hey David,

    I was wondering if you’ve made any advances with that functionality. I tried my best and pulled out a number of hairs trying to get multi-pae navigation setup, without much success. Are you having better luck?

    Reply
  16. Justin Kunst says

    September 27, 2012 at 5:58 pm

    I noticed that when using this, it does not save the form data. As an example, I’m working on a multi-page form for submitting video slides. At the end, it shows a confirmation page (Thanks to your script!) and gives then the option to jump back to any one page for additional edits. But when they click the link, the entries are BLANK! In fact, all navigation between the slides using these links makes the pages blank. What ever can I do???

    Reply
    • David Smith says

      September 27, 2012 at 8:36 pm

      Hi Justin, this script is purely for debugging purposes. I can see the benefit of being able to jump back to any page and I’m actually going to be working on a project soon that requires that functionality. I’ll be sure to update this thread (and you) when that functionality is ready. :)

    • David Smith says

      November 2, 2012 at 10:39 pm

      Hi Justin, I’m going to be doing this within the next couple of weeks. The project I referenced previously is still in progress. Please do feel free to remind me again if I haven’t posted a solution by mid-November. :)

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Categories

  • How To (29)
  • News (20)
  • Plugins (5)
  • Releases (5)
  • Resource (1)
  • Snippets (61)
  • Tip (1)
  • Tutorials (43)
  • Updates (62)

Recent Posts

  • Gravity Wiz Weekly #62
  • Gravity Forms Populate Anything, Public Beta Available!
  • Gravity Wiz Weekly #61
  • Gravity Wiz Weekly #60
  • Gravity Wiz Weekly #59

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Copyright © 2019 · Powered by WordPress · Gravity Wiz LLC · Log out

  • Support
  • Affiliates
  • About
  • Sitemap
  • Gravity Perks
    ▼
    • Gravity Perks
    • Tutorials & Snippets
    • About
  • Support
    ▼
    • Documentation
    • Support
    • Account