In SharpSpring, you can create forms directly in the application or you can map existing forms on your website. Once you have integrated your Gravity Form with SharpSpring, you may need to take additional steps if you have a checkbox group on your form. This article outlines what you need to adjust in your Gravity Form code to map checkbox data into SharpSpring.
Adjusting Gravity Form Code
For a Checkbox group, you need to add some additional code just above the section starting with $body. In this example, field 4 of the Gravity Form is a checkbox group. You need to add the following code snippet above the $body section:
$field_id = 4;
$field = GFFormsModel::get_field( $form, $field_id );
$field_value_4 = is_object( $field ) ? $field->get_value_export( $entry ) : '';
You then need to replace the number 4 within the above code snippet with the field number of your checkbox group. Then within the $body section, change the following code snippet:
'My Checkbox Group' => rgar( $entry, '4' ),
Replace that line above with the following code:
'My Checkbox Group' => $field_value_4,
Our code expects a comma separated list, but Gravity Forms treats each checkbox as a single checkbox field rather than a group. The above solution will combine the checkbox group into a comma-separated list, and store it in $field_value_4.
Additionally, some Gravity Forms have fields that are subfields of a main field. The most common example is a "Name" field that appears as two separate fields on the form, one for Fist Name, and one for Last, but both may be contained in field 7.
In this case, you'd need to determine the subfield IDs within your Gravity forms. You may find, for example, that while Name is field 7, First Name is field 7.3 and Last name is 7.6. You can then refer to these as you would any field number in the code.
Note: In some places, you may see subfields listed within an underscore, for example 7_3 rather than 7.3. When adding the field to your PHP code, be sure to use a decimal point rather than an underscore, as it requires the decimal there to identify the field.