There are several ways to automatically populate fields. You can autofill fields by pulling values from the current user's profile, for example. You can autofill fields by retrieving submitted values from the current user, IP address, or entry ID. If your users will be going directly from Form A to Form B, you can pass values from Form A to Form B via the entry key. You can also autofill fields by using Dynamic fields.
Pass values from Form A to Form B
If users are going directly from Form A to Form B, follow the instructions below to pass values from Form A to Form B.
- Go into Form A and click on Settings → Actions & Notifications.
- Click the Confirmation action and select the Redirect to URL button.
- In the Redirect URL box, insert the URL of the page that contains Form B followed by a parameter that includes the entry key from Form A.
Leave [key] as is because this shortcode will get the entry key.
- Go into Form B. Insert the [frm-field-value field_id=x entry=pass_entry] shortcode in the Default Value box in the field options. Replace x with the ID or key of any field from Form A. This shortcode will pull the value from the specified field and entry.
If you're populating a file upload field, insert the [frm-field-value field_id=x entry=pass_entry show=id sep=","] shortcode.
- Now, when a user submits Form A, they will be taken to Form B. The entry key from Form A will be passed in the URL. The frm-field-value shortcode will use that entry key to fetch values from the specified fields in Form A.
Populate fields for current user
If you would like to populate fields with values submitted by the current logged-in user, use this shortcode: [frm-field-value field_id=x user_id=current]. Insert the shortcode into the Default Value box in the field options.
Replace x with the ID of the field that you would like to get the value from.
If the current user has submitted multiple entries in that field, this shortcode will get the value from the user's most recent entry.
Get values from the user's profile
- Go into the form that you would like to autopopulate with values from the user's profile.
- Insert any of the following shortcodes into the Default Value box of the field options:
- [first_name] - Retrieves the user's first name
- [last_name] - Retrieves the user's last name
- [display_name] - Retrieves the user's display name
- [login] - Retrieves the user's username/login
- [user_id] - Retrieves the user's ID number
- [email] - Retrieves the user's email address
- [user_role] - Retrieves the user's WordPress role
- [user_meta key="address"] - Retrieves specific user meta from the user's profile. Replace "address" with the name of your user meta.
If you would like to be able to add custom user meta to the user's profile, you may use the User Registration add-on for this.
Get values from selected entry
If you would like to automatically populate fields based on a selected entry, follow the directions below.
- Publish the form that you want to autofill on a page. Copy the URL of this page.
- Create a new form called Select entry. This form is where the user will make their entry selection.
- Add a Dynamic Field with Dropdown as the display type.
- Set it to load options from Form Entries. In the next dropdown, select the form that you want to pull values from. Select any field from that form.
- Go into the Select entry form and click on Settings → Actions & Notifications.
- Click the Confirmation action and select the Redirect to URL button.
- In the Redirect URL box, insert the URL copied from Step 1.
- Add ?pass_entry=[x show=key] to the end of the URL.
Replace x with the ID of the Dynamic Field.
- Go into the form that you want to autofill. Insert the [frm-field-value field_id=x entry=pass_entry] shortcode in the Default Value box of the field options.
Replace x with the Key or ID of the field that you want to pull the value from. - Now when the user submits the Select entry form, it will populate fields with values from the selected entry.
Populate fields by IP address
If your users will not be logged-in and you would like to pull values from another form they submitted, use this shortcode: [frm-field-value field_id=x ip=1]. Insert the shortcode into the Default Value box in the field options.
Replace x with the ID of the field that you would like to get the value from.
Please note, this method has inherent flaws. If the same person uses a different computer, for example, this shortcode will not pull a value from the specified field. If multiple entries have been submitted in Form A from the same IP address, this shortcode will get the value from the most recent entry.
Populate fields by entry ID/key
If you would like to pull values from a particular entry to populate your current form, use this shortcode: [frm-field-value field_id=x entry=1296]. Insert the shortcode into the Default Value box in the field options.
Replace x with the ID of the field that you would like to get the value from and replace 1296 with the entry ID or key that you want to pull values from.
Populating with fields that have separate values
You may want to populate using a field that has separate values. By default, [frm-field-value] will show the label. If you want to show the saved value instead, add the show="value" param. For example, [frm-field-value field_id=x show="value"].
Pass values from form to URL
If you want to include the information you submit in the form directly in the URL, you can use the [get param] shortcode. Check out this guide on how to get a parameter from the URL.