mermberfix logo x
The MemberFix Team’s got you covered.
Membership plugins

How to save and pre-populate fields in GravityForms

default values

Overview

In this article you’ll learn how to create a special form where users can save default field values which other forms can use to pre-populate their fields.

Requirements

Please make sure you have installed these plugins/add-ons before following this article:

Creating a “Default Settings” Form

Go ahead and create new form Forms => New Form.

90823195 - How to save and pre-populate fields in GravityForms

Now we have to add fields we want users to be able to save as their default values.
As an example I have added 3 fields:

  • My Music Taste
  • My Movie Taste
  • My Hobbies

90823284 - How to save and pre-populate fields in GravityForms

Make sure to click Update after you finish adding your fields.

Now we have to make these field values permanent. To do that, in Gravity Forms Editor navigate to Settings tab and click on User Registration.


90823328 - How to save and pre-populate fields in GravityForms

These User Registration Feeds serve to save values entered by the user which we will later use to auto-fill some fields in other forms. To add a new feed, click on Add New button.

In the Feed Settings editor give your feed some meaningful name and click on the Update User button.

90823405 - How to save and pre-populate fields in GravityForms

User Settings

If you want to update a user’s data through this form, you can use these fields. Otherwise just skip them. We will skip them in this article since we are only using custom fields.

User Meta

To make our 3 fields permanent values we will assign those fields as User Meta values. First select one of your fields in the Select a Field drop-down. Then select the Add Custom Meta in the Select Meta Key drop-down.

90823580 - How to save and pre-populate fields in GravityForms

Now give your meta key a name that is related to the field, for example “hobbies” (I advise you always use lower caps letters only, and an underscore ( _ ) if you want to use more than one word when assigning meta key names eg. “my_hobbies”).

 

90823638 - How to save and pre-populate fields in GravityForms
Repeat this for all your fields
90823696 - How to save and pre-populate fields in GravityForms

Additional Options

Leave Update Condition unchecked.

When you are done with the steps above, click on the Update Settings button. Now you can close this form.

Pre-filled fields

I have created another Form whose fields should be pre-filled with the Default Settings form’s fields we created above.

90823900 - How to save and pre-populate fields in GravityForms

To make those fields pre-filled by the values we enter in our Default Settings form, we have to give them a Default Value attribute.

To do this click on one of your fields and click on Advanced tab. Under Default Value you should use this code: {user:YOUR_META_KEY} and replace YOUR_META_KEY with your meta key.

In this case, because I set My Hobbies meta key as hobbies, I’ll have to enter {user:hobbies}

90823978 - How to save and pre-populate fields in GravityForms

Repeat this for all other fields.

When you are done, click on Update button. And now fields on this form will be pre-filled.

Result

Default Settings Form Page

Create a new page and add the Default Form we created in the first step. Open it and enter something in the fields.

90824142 - How to save and pre-populate fields in GravityFormsClick Submit and your values should be saved and will be pre-filled in the fields you specified.

Regular Form Page

Open your regular form page—the one we edited in step 2. And now the fields where you added your {user:META_KEY} merge tags as the Default Value will be pre-filled!

90824268 - How to save and pre-populate fields in GravityForms

If it’s not working please make sure you are using the same meta key name in the User Registration Settings of your Default Values form and in your Regular form fields as the Default Values {user:meta_key}.

If it’s still not working, repeat all the steps above and make sure you did everything correctly. Or, leave a comment below and we’ll help. 🙂

Video walkthrough

Conclusion

With this feature, your users and members will no longer have to waste time on entering values each time they want to submit a form.

For example if you have a checkout form with some custom fields that a user fills with the same values each time they make a purchase, it will be pre-filled with the values they save in the Default Values form. Or, if you run a service where your customers log into a backend and submit orders or various details to you, this approach can improve the user experience for your customers.

Finally, if you’d like our team to set this up for you (and save yourself the cost of GravityForms) take a look at our MemberFix service and get us to do it for you!

You may also enjoy...

WordPress based membership sites have certain requirements, and make use of certain applications that, in my experience, makes most of the popular hosting providers a poor choice.

Stripe integrations can get complicated. So even when you have a pre-made solution, such as the one MemberPress provides, you should set everything correctly to avoid any payment issues. But

How to backup the whole bucket to local machine using AWS Comand Line Interface (AWS CLI).
Our review is based on actual, real world experience “in the trenches” using and working with this plugin for over 5 years!
Subscribe
Notify of
guest
11 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Lisa Cowan
Lisa Cowan
September 12, 2019 7:11 pm

Thanks for posting these instructions. I was stuck trying to figure out how to pass the form fields, and this really helped. I’ve been able to pass 2 of the 3 fields I need, but I can’t get the email field to work. At first I thought it might be because of the way WordPress uses the email field as part of it’s login, but I’ve successfully used username as a meta key. I’ve tried several different names for it in the meta key: email, user_email, and email_address, but none of them work. Do you have any ideas for me?… Read more »

Vic Dorfman
Admin
Reply to  Lisa Cowan
September 20, 2019 3:31 am

Hi Lisa,

Hmm…I’d really have to get into your site to see what the issue might be.

Megan
Megan
September 24, 2019 12:50 pm

Hi, thank you for this information ! It has been really helpful, however now I am trying to accomplish the same thing but with checkbox fields. I would like them to be saved and then pre-filled the next time our users go back to the form except I’m not sure how to go about this since there is no default value option in the advanced tab of a checkbox field. Would you know a way to achieve this using user registration ?
Thank you !

Vic Dorfman
Admin
Reply to  Megan
September 26, 2019 6:56 pm

Hi Megan, great question!

Here’s a tutorial I found on how to allow prepopulation of checkbox fields:

https://resoundingechoes.net/development/pre-populating-checkboxes-gravity-forms/

V

Helen Leigh
December 2, 2019 10:10 am

Hi, these instructions are great, I wondered if I already have a form users have completed in the past (1 year ago) can i make this the default form and then create a new one.

Will the new one find the information from the old form (completed by the user before i made it the default form),?

Or do you have to make the form default then collect the information for it then to work? i.e past information already held on the entries makes no difference.

Thanks

Vic Dorfman
Admin
Reply to  Helen Leigh
December 4, 2019 12:17 am

Hi Helen, You could get the new form to recognize the data from previous submissions, yes. 🙂 But you would need to do one of two things. 1 – If the form that your users completed 1 year ago took their answers and placed them in their user meta fields like we explain in this tutorial, then the new form would be able to pull those answers / preferences into it by checking the logged in user’s meta fields and populating the new form with the values in those fields. 2 – If you didn’t do that, you would have… Read more »

Jez
Jez
March 5, 2020 12:41 pm

I’m in the same situation as Helen. I have a form that users have filled in for over a year. I want to take certain fields from that form & prefill another form. How do I make the original form the default form? How do I get those fields across to the new? Your guidelines outlined above do not work for my situation?

Albin Gasi
Reply to  Jez
April 7, 2020 7:33 pm

Hi Jez,

You can create a new form and pre-fill the data you want from the previous as well.

You can do that using the meta_key as we described in this tutorial in the section “Pre-filled fields”, but please, make sure that you use the right meta key that you used when you created the default form (like we describe here: https://www.screencast.com/t/RBhtbfknPo).

Let us know if you need more help or you can send us a screenshot of the problem.
We will be happy to help you.

Best regards,
Albin

Nick
June 12, 2020 5:07 pm

If you are looking for a high-quality plugin to allow easy syncing of data between separate Gravity forms, make sure to check out our Entries Importing for Gravity Forms Plugin, here: https://plugins.viastudio.c
 
We’re a long-time WordPress development shop, and are releasing our plugins to the public, with docs and support. Cheers!

Vic Dorfman
Admin
Reply to  Nick
July 15, 2020 11:01 am

Thanks for the share, Nick! Your plugins look great. 🙂

Steph
Steph
January 5, 2021 9:48 pm

I’m having the same difficulty that Lisa Cowan did below. I have one field that saved and pre-populated, but none of my other fields did. I went through the instructions again and everything looks to be done the same.