How to add a Data Persistence Functionality in Gravity Forms

But surely, the Gravity Forms plugin has certain features, it could improve.

Case in point-> ‘Save and Continue’.

Whether you call it the ‘Save and Continue’ functionality, ‘Save Progress’ or ‘Save and Resume’, you know that for tedious multi-page forms, this functionality is a must. But for a while, the Gravity Forms plugin did not have a save progress feature.

It provides a setting at every form level, using which you can enable a ‘Save and Continue’ option

If this option is enabled, a ‘Save and Continue’ link is shown next to the submit button

If a user clicks this link, he/she is emailed another link. This link provides a user access to previously saved data

Now, this default functionality seems to do the job in certain scenarios, but it has a few limitations. For example, the user has to keep track of the save link, to restore his/her data. And what’s more is, every time the user clicks the save progress link, the entry is not updated, but instead, a new entry is saved.

I’ve noticed quite a few people ask whether they could update the data instead of creating a new entry each time.

That’s an interesting point (and a limitation I needed to solve).

You see, the default functionality provided by the Gravity Forms plugin, adds a new entry each time the save link is clicked. Instead, Gravity Forms users are looking to maintain just one entry per form filler, and update it each time the save option is clicked. So, there isn’t a need to provide a ‘save progress’ link.

What we would need to do, is check if the person filling the form, had previously saved the form, and then load the saved data.

Updating User Progress in Gravity Forms using the Data Persistence Add On

While attempting to find a solution for this particular scenario, I stumbled upon an extension plugin for Gravity Forms- the Gravity Forms Data Persistence add-on. Although upon further review, I found the updated version of the plugin- the Gravity Forms Data Persistence add-on Reloaded.

This plugin seemed promising. Based on the description, it seemed to solve my problem at hand. But unfortunately, it just didn’t work right.

The plugin seemed to be a very simple (but a powerful) plugin with few lined of code. I tried debugging the issue, and found the below piece of code:

add_action("gform_post_submission", "set_post_content", 10, 2);

The obvious problem was that the plugin was using a deprecated hook- gform_post_submission. This particular hook seemed to be the reason the plugin was not working.

Now, I suggest once you’ve made these changes, you can add the hooks in a separate plugin or your theme. This will save you from the hassle of maintaining additional code in the original plugin, when you update it.

This code will hook into the default functionality provided by the plugin to work for any user instead of just logged in user.

Once you’re done with this, you’ll have a much simpler way to maintain a user’s data, even for users who aren’t logged in.

The advantage of adopting this approach is that you can maintain persistent data for logged in as well as guest users. And, you don’t even need a separate link to save user progress. The ‘submit’ button can be used to save the progress as well as submit the form.

Got any questions? Feel free to add them as comments, in the comment section below.

Comments

squidz:

I’ ve been trying to get this plugin to work with Gravity Forms for a long multipage form. One must be logged in for to use it. But, I have tried to find the line you mention that was using the wrong hook and fix it. However, it still does not work.

I’m using the Add-on v 3.2.3 and Gravity 9.1.16

I find this line, which seems to be about clearing rather than storing: