In order to capture form submission data into WP Contacts from a Gravity form you will simply tie fields together using the Admin Label (or for hidden fields you would use just the label) of a Gravity form field and give it the correct format and field to map to. If you want to preset fields (which you most likely will) for submissions you can use hidden fields and insert a preset value to be populated in WP Contacts.
The naming convention is very important for the Admin Label as this will enable saving the contact into WP Contacts and decide what field will be populated from the form. The naming convention that needs to be used under the Admin Label (or Label for hidden fields) of the Gravity form is in the following format:
wpcontacts-fieldname
so for example let’s say you were going to map the Gravity form text field for Name to the first name field of WP Contacts.
First, open up WP Contacts and go to Manage FIelds here you will see your fields with the database field name as the field label, this is what you use to map the fields.
Next, go to your form and use the naming convention of wpcontacts-first_name in the Admin Field Label of the form field under the Advanced Tab for the field to map.
note: If using a hidden field, you will only have the option to set the label since there is no Admin Label for hidden fields, just put your wpcontacts-fieldname there instead.
Do this for each field you want your Gravity form to send to WP Contacts when the form is submitted. Remember to use hidden fields for preset values and to use the correct naming convention for the Admin Field Label. You can map to any of the WP Contacts fields you would like except for the following as these are automatically generated upon creation…
- creation_date
- created_by
- updated_date
- updated_by
- id
Optional – You can optionally set the database to be used (if you have more than 1 database created in WP Contacts) by giving a hidden field the label of wpdatabasemap and a preset value of the database name by setting the Default Value to the database name. Otherwise, entries will go to your default database.
(WP Contacts v3.2.9+)
If you would like to split a standard field (like a name field) into a first and last in WP Contacts you can use our split field naming convention for those like so: **wpcontacts-wcpsplit-first_name-last_name
**
Where we are using our ‘wcpsplit’ naming convention and the two fields are separated by the ‘-‘ (example above uses the ‘first_name’ and ‘last_name’ fields). This is intended for text fields.
This method will also work with the Advanced name field when using multiple name pieces, just be sure to map the name pieces in correct order using the format above.
(WP Contacts v3.2.9+)
Check box fields from Gravity Forms are meant to be mapped to a single checkbox field in WP Contacts. So for multiple checkboxes in Gravity Forms being mapped, use individual fields for each. Or you can use the ‘wcpsplit’ method above to map a single Gravityform checkbox entry (with multiple checkboxes) to multiple checkboxes in WP Contacts.