bookmark_bordergform_SLUG_field_value

Description

This filter can be used to modify a value before it is sent to a third-party by one of the Add-on Framework based add-ons. If you want to filter the value for any add-on you can use gform_addon_field_value

Slugs

These slugs are currently supported:

  • gform_activecampaign_field_value
  • gform_agilecrm_field_value
  • gform_authorizenet_field_value
  • gform_batchbook_field_value
  • gform_breeze_field_value
  • gform_capsulecrm_field_value
  • gform_cleverreach_field_value
  • gform_dropbox_field_value
  • gform_emma_field_value
  • gform_getresponse_field_value
  • gform_helpscout_field_value
  • gform_highrise_field_value
  • gform_icontact_field_value
  • gform_madmimi_field_value
  • gform_paypal_field_value
  • gform_slack_field_value
  • gform_stripe_field_value
  • gform_trello_field_value
  • gform_zohocrm_field_value

Usage

The base filter which would run for all forms and all fields would be used like so:

add_filter( 'gform_helpscout_field_value', 'your_function_name', 10, 4 );

To target a specific form append the form id to the hook name. (format: gform_SLUG_field_value_FORMID)

add_filter( 'gform_helpscout_field_value_10', 'your_function_name', 10, 4 );

To target a specific field append both the form id and the field id to the hook name. (format: gform_SLUG_field_value_FORMID_FIELDID)

add_filter( 'gform_helpscout_field_value_10_3', 'your_function_name', 10, 4 );

Parameters

  • $value string

    The value to be modified.

  • $form

    The Form currently being processed.

  • $entry Entry Object

    The Entry currently being processed.

  • $field_id string

    The ID of the Field currently being processed.

Examples

1. Help Scout – Change value of specific field

This example shows how you can change the value of field 3 on form 10 before it is passed to Help Scout.

add_filter( 'gform_helpscout_field_value_10_3', function ( $value, $form, $entry, $field_id ) {

    return 'your new value';
}, 10, 4 );

2. ActiveCampaign – Use choice text instead of value

This example shows how you can replace the value of a choice based survey field with the choice text.

add_filter( 'gform_activecampaign_field_value', 'gf_get_choice_text', 10, 4 );
function gf_get_choice_text( $value, $form, $entry, $field_id ) {
    $field = RGFormsModel::get_field( $form, $field_id );

    if ( is_object( $field ) && $field->type == 'survey' ) {
        $value = $field->get_value_export( $entry, $field_id, true );
    }

    return $value;
}

3. Zoho CRM – Format Date Field

This example shows how you can reformat the entry date from yyyy-mm-dd to the format configured on the field.

add_filter( 'gform_zohocrm_field_value', function ( $value, $form, $entry, $field_id ) {
    $field = RGFormsModel::get_field( $form, $field_id );

    if ( is_object( $field ) && $field->type == 'date' ) {
        $value = GFCommon::date_display( $value, $field->dateFormat );
    }

    return $value;
}, 10, 4 );

4. ActiveCampaign – Replace commas with pipes

This example shows how you can replace the commas used to separate checkbox choices with pipe characters.

add_filter( 'gform_activecampaign_field_value', 'format_checkbox_value', 10, 4 );
function format_checkbox_value( $value, $form, $entry, $field_id ) {
    $field = RGFormsModel::get_field( $form, $field_id );

    if ( is_object( $field ) && $field->type == 'checkbox' ) {
        $value = str_replace( ', ', '||', $value );
    }

    return $value;
}

5. Zoho CRM – Format Checkbox Field

This example shows how you can reformat the checkbox field value to pass true or false instead of the choice.

add_filter( 'gform_zohocrm_field_value', function ( $value, $form, $entry, $field_id ) {
    $field = RGFormsModel::get_field( $form, $field_id );

    if ( is_object( $field ) && $field->get_input_type() === 'checkbox' ) {
        $value = $value ? 'true' : 'false';
    }

    return $value;
}, 10, 4 );

Placement

This code should be placed in the functions.php file of your active theme

Source Code

gf_apply_filters( "gform_{$slug}_field_value", array(
	$form['id'],
	$field_id
), $field_value, $form, $entry, $field_id );

This filter is located in GFAddOn::maybe_override_field_value() in includes/addon/class-gf-addon.php

Since

This filter was added in Gravity Forms 1.9.10.11.

Other Add-ons

Some add-ons released before this filter was added implement an older version of this filter using different parameters. Also, they don’t implement the form and field specific versions. See the following pages of the documentation for usage examples: