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-handedly (and quite succinctly) puts all those painful multi-page debugging memories behind you.
<?php | |
/** | |
* Gravity Wiz // Gravity Forms // Skip Pages on Multi-Page Form | |
* http://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; | |
} |
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 usage | http://yoursite.com/multi-page-form/?form_page=4 |
Used with other parameters | http://yoursite.com/?p=123&form_page=4 |
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 31+ essential add-ons for Gravity Forms with support you can count on.
Hey David very helpful as always!!
I have a question – hoping I’m not completely off-topic. Ive been using gravity forms for about 3 months now, have created 9 forms most of them multi-page.
In the front end, when i go from page one to page two, I usually see the ID of the form at the end of the url – for example http://www.yourdomain.com/form-page/#gf_10 (10 being the ID of the form).
In one of my forms this doesn’t show up and I’ve noticed that when refreshing the page it doesn’t shoot a message prompting me to resend the information (as it happens in all other forms) it just starts from page 1. In addition the form is really slow.
Any thoughts on that?
Hi Theodore, it sounds like the form withou the #gf_10 has AJAX-enabled. I wouldn’t expect this to slow your form down though. I’d reach out to Gravity Forms support on this one though. They’ll get you a definitive answer. 🙂
Hello David, I found your blog while trying to improve the experience with a form am Implementing. The problem I am having is I have a button before the forms shows up. After I click the button it loads the form, but since its a multi-page form, when I try to go to the second page it never scrolls down to the end of that page, thus not allowing the user to continue to “next” page. Is there a way to solve this that you can suggest
Thanks for all yur info!
Hi Marina, do you have a URL where I could see the form? I’m not sure I’m understanding your use-case.
Thanks for this, it’s a HUGE help! Your snippets are invaluable!
Glad to help, Jennifer!
YOU ARE MY HERO. This works flawlessly. I was about to roll it myself, but you saved me so much time!
Glad to hear it, Brent!
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?
Hi Kashif, I think this might be what you’re looking for: http://travislop.es/plugins/gravity-forms-multi-page-notifications/
You are a live saver sir :) thank you so much!
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
Hi Anur, you can determine whether a page is skipped via the “Page Conditional Logic”: http://grab.by/ERFY
The snippet to skip multi-page Gravity Forms worked for a long time, but no longer works. What’s going on?
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.
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.
Glad you were able to find a solution. :)
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.
Really appreciate the kind words Mark! Glad you found this useful. :)
Alright party people! After much ado, I present Multi-page Form Navigation! Give it a shot and give me suggestions for improvement. :)
Subscribing for update to :)
Thanks for a great post!
Registering for followup comments.
Thanks for the Pro Tip.
Any update David?
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
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….
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.
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?
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. :)
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?
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???
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. :)
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. :)