gform_column_input

gform_column_input

DescriptionUsageParametersExamplesPlacementSource Code

Description
This filter can be used to specify a different input type for a list field column. Currently supported field types are 「select」 (Drop Down) and 「text」 (Text Field)
Usage
1add_filter( 'gform_column_input', 'set_column_input', 10, 5 );
You can also target a specific column by adding the form id, field id and column number after the hook name. (format: gform_column_input_FORMID_FIELDID_COLUMN)
12//This filter declaration targets the first column of field whose id is 2 in form whose id is 6add_filter( 'gform_column_input_6_2_1', 'set_column_input', 10, 5 );

Parameters

$input_info array
The input info array to be filtered, in the following format:
12345678910111213array(    'type' => 'select',    'choices' => 'First Choice,Second Choice'); // OR, if values need to be specified for each choice, the following format can also be used:array(    'type' => 'select',    'choices' => array(        array( 'text' => 'First Choice', 'value' => 'First' ),        array( 'text' => 'Second Choice', 'value' => 'Second' )    ));

$field Field Object
Current field.

$column string
Current column name.

$value string
Currently entered/selected value for the column』s input.

$form_id integer
ID of current form.

Examples
This example changes column 1 of list field 2 in a form with id 187 to a drop down.
1234add_filter( 'gform_column_input_187_2_1', 'set_column', 10, 5 );function set_column( $input_info, $field, $column, $value, $form_id ) {    return array( 'type' => 'select', 'choices' => 'First Choice,Second Choice' );}
Placement
This code should be placed in the functions.php file of your active theme
Source Code
This filter is located in GF_Field_List::get_list_input() in includes/fields/class-gf-field-list.php

gform_column_input_content

gform_column_input_content

DescriptionUsageParametersExamplesPlacementSource Code

Description
This filter can be used to modify the HTML content of the list field column input tag.
Usage
1add_filter( 'gform_column_input_content', 'your_function_name', 10, 6 );
You can also target a specific column by adding the form id, field id and column number after the hook name. (format: gform_column_input_content_FORMID_FIELDID_COLUMN)
12//This filter declaration targets the third column of the field whose id is 9 in form whose id is 21add_filter( 'gform_column_input_content_21_9_3', 'your_function_name', 10, 6 );

Parameters

$input string
The current HTML content of the List field column

$input_info array
The input info array to be filtered, in the following format:
12345678910111213array(    'type' => 'select',    'choices' => 'First Choice,Second Choice'); // OR, if values need to be specified for each choice, the following format can also be used:array(    'type' => 'select',    'choices' => array(        array( 'text' => 'First Choice', 'value' => 'First' ),        array( 'text' => 'Second Choice', 'value' => 'Second' )    ));

$field Field Object
Current field.

$text string
Current column name.

$value string
Currently entered/selected value for the column』s input.

$form_id integer
ID of current form.

Examples
This example changes the third column of the list field to a textarea. To display the value on the entry in the admin, make sure you include using $value in the appropriate location for your tag creation.
12345678add_filter( 'gform_column_input_content_21_9_3', 'change_column3_content', 10, 6 );function change_column3_content( $input, $input_info, $field, $text, $value, $form_id ) {    //build field name, must match List field syntax to be processed correctly    $input_field_name = 'input_' . $field->id . '[]';    $tabindex = GFCommon::get_tabindex();    $new_input = '';    return $new_input;}
Placement
This code should be placed in the functions.php file of your active theme
Source Code
This filter is located in GF_Field_List::get_list_input() in includes/fields/class-gf-field-list.php

gform_{$SHORT_SLUG}_field_value

gform_{$SHORT_SLUG}_field_value

DescriptionShort Slug ValuesUsageParametersExamples1. ActiveCampaign – Use Choice Text Instead of Value2. ActiveCampaign – Replace Commas with Pipes3. Emma – Format Checkbox Field4. Help Scout – Change Value of Specific Field5. Zoho CRM – Format Date Field6. Zoho CRM – Format Checkbox FieldPlacementSinceSource Code

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.
Short Slug Values
The Gravity Forms Add-On Slugs article lists the available short slugs to use with this hook:
The following add-ons listed in the slug article do not use the hook:

Gravity Forms CLI Add-On
Gravity Forms Debug Add-On
Gravity Forms Gutenberg Add-On

The Zapier Add-On implements its own version of the hook:

gform_zapier_field_value

Usage
The base filter which would run for all forms and all fields would be used like so:
1add_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_{$SHORT_SLUG}_field_value_FORMID)
1add_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_{$SHORT_SLUG}_field_value_FORMID_FIELDID)
1add_filter( 'gform_helpscout_field_value_10_3', 'your_function_name', 10, 4 );

Parameters

$value string
The value to be modified.

$form Form Object
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. 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.
1234567891011add_filter( 'gform_activecampaign_field_value', 'gf_get_choice_text', 10, 4 );function gf_get_choice_text( $value, $form, $entry, $field_id ) {    gf_activecampaign()->log_debug( __METHOD__ . '(): running.' );    $field = GFAPI::get_field( $form, $field_id );     if ( is_object( $field ) && $field->type == 'survey' ) {        $value = $field->get_value_export( $entry, $field_id, true );        gf_activecampaign()->log_debug( __METHOD__ . '(): Value: ' . $value );    }    return $value;}
2. ActiveCampaign – Replace Commas with Pipes
This example shows how you can replace the commas used to separate checkbox or multi select choices with pipe characters.
123456789101112add_filter( 'gform_activecampaign_field_value', 'gf_replace_commas_with_pipes', 10, 4 );function gf_replace_commas_with_pipes( $value, $form, $entry, $field_id ) {    gf_activecampaign()->log_debug( __METHOD__ . '(): running.' );    $field = GFAPI::get_field( $form, $field_id );     if ( is_object( $field ) && ( $field->type == 'checkbox' || $field->type == 'multiselect' ) ) {        $value = str_replace( ', ', '||', $value );        gf_activecampaign()->log_debug( __METHOD__ . '(): Value: ' . $value );    }     return $value;}
3. Emma – Format Checkbox Field
This example shows how you can reformat the checkbox field value to be passed as an array instead of a string.
123456789add_filter( 'gform_emma_field_value', function ( $value, $form, $entry, $field_id ) {    $field = GFAPI::get_field( $form, $field_id );     if ( is_object( $field ) && $field->get_input_type() === 'checkbox' ) {        $value = explode( ', ', $value );    }     return $value;}, 10, 4 );
4. 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.
1234add_filter( 'gform_helpscout_field_value_10_3', function ( $value, $form, $entry, $field_id ) {     return 'your new value';}, 10, 4 );
5. 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.
123456789add_filter( 'gform_zohocrm_field_value', function ( $value, $form, $entry, $field_id ) {    $field = GFAPI::get_field( $form, $field_id );     if ( is_object( $field ) && $field->type == 'date' ) {        $value = GFCommon::date_display( $value, $field->dateFormat );    }     return $value;}, 10, 4 );
6. 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. This snippet is not needed if you』re using version 1.8 of the add-on or newer.
1234567891011add_filter( 'gform_zohocrm_field_value', function ( $value, $form, $entry, $field_id ) {    gf_zohocrm()->log_debug( __METHOD__ . '(): Running...' );    $field = GFAPI::get_field( $form, $field_id );     if ( is_object( $field ) && $field->get_input_type() === 'checkbox' ) {        gf_zohocrm()->log_debug( __METHOD__ . '(): Checkbox value to true or false.' );        $value = $value ? 'true' : 'false';    }     return $value;}, 10, 4 );
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms 1.9.10.11.
Source Code
1234gf_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.

gform_chosen_options

gform_chosen_options

DescriptionUsageParametersExamples1. Limit the number of items which may be selected in a multi-select field.2. Configure Chosen to use a percentage based width.3. Allow matches starting from anywhere within a word.PlacementSource Code

Description

Allows the Chosen jQuery script settings for Drop Down and Multi-Select fields to be modified when the 「Enable enhanced user interface」 is checked. Fires when the form is loaded and has a field using Chosen.

Usage

gform.addFilter( 'gform_chosen_options', function ( options, element ) {
return options;
} );

Parameters

options JS Object
The Chosen script options object. Additional documentation can be found in the Chosen 1.1.0 release.

allow_single_deselect bool
When set to true on a single select, Chosen adds a UI element which selects the first element (if it is blank).

disable_search bool
When set to true, Chosen will not display the search field (single selects only).

disable_search_threshold integer
Hide the search input on single selects if there are fewer than (n) options.

enable_split_word_search bool
By default, searching will match on any word within an option tag. Set this option to false if you want to only match on the entire text of an option tag.

inherit_select_classes bool
When set to true, Chosen will grab any classes on the original select field and add them to Chosen』s container div.

max_selected_options integer
Limits how many options the user can select. When the limit is reached, the chosen:maxselected event is triggered.

no_results_text string
The text to be displayed when no matching results are found. The current search is shown at the end of the text (e.g., No results match 「Bad Search」).

placeholder_text_multiple string
The text to be displayed as a placeholder when no options are selected for a multiple select.

placeholder_text_single string
The text to be displayed as a placeholder when no options are selected for a single select.

search_contains bool
By default, Chosen』s search matches starting at the beginning of a word. Setting this option to true allows matches starting from anywhere within a word. This is especially useful for options that include a lot of special characters or phrases in ()s and []s.

single_backstroke_delete bool
By default, pressing delete/backspace on multiple selects will remove a selected choice. When false, pressing delete/backspace will highlight the last choice, and a second press deselects it.

width int
The width of the Chosen select box. By default, Chosen attempts to match the width of the select box you are replacing. If your select is hidden when Chosen is instantiated, you must specify a width or the select will show up with a width of 0.

display_disabled_options bool
By default, Chosen includes disabled options in search results with a special styling. Setting this option to false will hide disabled results and exclude them from searches.

display_selected_options bool
By default, Chosen includes selected options in search results with a special styling. Setting this option to false will hide selected results and exclude them from searches.

Note: this is for multiple selects only. In single selects, the selected result will always be displayed.

element Js Object
The jQuery element object.

Examples

1. Limit the number of items which may be selected in a multi-select field.

gform.addFilter( 'gform_chosen_options', function ( options, element ) {
//form id = 85, field id = 5
if ( element.attr( 'id' ) == 'input_85_5' ) {
options.max_selected_options = 2;
}

return options;
} );

2. Configure Chosen to use a percentage based width.

gform.addFilter( 'gform_chosen_options', function ( options, element ) {
options.width = '75%';

return options;
} );

3. Allow matches starting from anywhere within a word.

This can be done by enabling the search_contains option provided by the Chosen script.

gform.addFilter( 'gform_chosen_options', function ( options, element ) {
options.search_contains = true;
return options;
} );

Placement

JavaScript should be placed in a JS file included by your theme or a custom plugin.

Source Code

This filter is located in 「gravityforms.js」

gform_choices_setting_title

gform_choices_setting_title

DescriptionUsageParametersExamplesPlacementSource Code

Description
Use this filter to change the 「Choices」 settings title in the admin for fields which have choices (drop down, radio button, checkboxes, multi select, product option).
Usage
1add_filter( 'gform_choices_setting_title', 'change_title' );
Parameters

$title string
The current title of the 「Choices」 setting.

Examples
This example changes the title from 「Choices」 to 「My Custom Title」.
1234add_filter( 'gform_choices_setting_title', 'change_title' );function change_title( $title ) {    return 'My Custom Title';}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in form_detail.php

gform_checkbox_select_all_label

gform_checkbox_select_all_label

DescriptionUsageParametersExamples1. All forms2. Specific form3. Specific checkbox field on a formPlacementSinceSource Code

Description
The 「gform_checkbox_select_all_label」 filter in Gravity Forms allows the 「Select All」 label for the Checkboxes field to be modified.
Usage
The following would apply to all forms:
1add_filter( 'gform_checkbox_select_all_label', 'your_function_name', 10, 2 );
To target a specific form, append the form id to the hook name. (format: gform_checkbox_select_all_label_FORMID)
1add_filter( 'gform_checkbox_select_all_label_1', 'your_function_name', 10, 2 );
To target a specific field for a form, append the form id and field id to the hook name. (format: gform_checkbox_select_all_label_FORMID_FIELDID)
1add_filter( 'gform_checkbox_select_all_label_1_22', 'your_function_name', 10, 2 );

Parameters

$select_label string
The 「Select All」 label.

$field Field Object
The field object for the current field.

Examples
1. All forms
1234add_filter( 'gform_checkbox_select_all_label', 'change_label', 10, 2 );function change_label( $select_label, $field ){    return "My Custom Select All";}
2. Specific form
1234add_filter( 'gform_checkbox_select_all_label_114', 'change_label', 10, 2 );function change_label( $select_label, $field ){    return "My Custom Select All";}
3. Specific checkbox field on a form
1234add_filter( 'gform_checkbox_select_all_label_114_2', 'change_label', 10, 2 );function change_label( $select_label, $field ){    return "My Custom Select All";}
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms version 2.3.
Source Code
This filter is located in GF_Field_Checkbox::get_checkbox_choices() in gravityforms/fields/includes/class-gf-field-checkbox.php.

gform_checkbox_deselect_all_label

gform_checkbox_deselect_all_label

DescriptionUsageParametersExamples1. All forms2. Specific form3. Specific checkbox field on a formPlacementSinceSource Code

Description
The 「gform_checkbox_deselect_all_label」 filter in Gravity Forms allows the 「Deselect All」 label for the Checkboxes field to be modified.
Usage
The following would apply to all forms:
add_filter( 'gform_checkbox_deselect_all_label', 'your_function_name', 10, 2 );

To target a specific form, append the form id to the hook name. (format: gform_checkbox_deselect_all_label_FORMID)
add_filter( 'gform_checkbox_deselect_all_label_1', 'your_function_name', 10, 2 );

To target a specific field for a form, append the form id and field id to the hook name. (format: gform_checkbox_deselect_all_label_FORMID_FIELDID)
add_filter( 'gform_checkbox_deselect_all_label_1_22', 'your_function_name', 10, 2 );

Parameters

$select_label string
The 「Select All」 label.

$field Field Object
The field object for the current field.

Examples
1. All forms
add_filter( 'gform_checkbox_deselect_all_label', 'change_deselect_label', 10, 2 );
function change_deselect_label( $select_label, $field ){
return "My Custom Deselect All";
}

2. Specific form
add_filter( 'gform_checkbox_deselect_all_label_114', 'change_deselect_label', 10, 2 );
function change_deselect_label( $select_label, $field ){
return "My Custom Deselect All";
}

3. Specific checkbox field on a form
add_filter( 'gform_checkbox_deselect_all_label_114_2', 'change_deselect_label', 10, 2 );
function change_deselect_label( $select_label, $field ){
return "My Custom Deselect All";
}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms version 2.3.
Source Code
This filter is located in GF_Field_Checkbox::get_checkbox_choices() in gravityforms/fields/includes/class-gf-field-checkbox.php.

gform_field_choices

gform_field_choices

DescriptionUsageParametersExamplesPlacementSource Code

Description
This filter is executed when creating the checkbox or radio button items. It can be used to manipulate the item』s string before it gets added to the checkbox or radio button list.
Usage
1add_filter( 'gform_field_choices', 'form_submit_button', 10, 2 );
Parameters

$choices string
The string containing the choices to be filtered i.e.
1$field Field Object
The current field.

Examples
This example demonstrates how to allow HTML characters on checkbox and radio items.
12345add_filter( 'gform_field_choices', 'decode_specialchars', 10, 2 );function decode_specialchars( $choices, $field ) {    $choices = htmlspecialchars_decode( $choices );    return $choices;}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in the following methods:

GF_Field_Checkbox::get_checkbox_choices() in includes/fields/class-gf-field-checkbox.php
GF_Field_Radio::get_radio_choices() in includes/fields/class-gf-field-radio.php

gform_chainedselects_max_file_size

gform_chainedselects_max_file_size

DescriptionUsageParametersExamplesPlacementSource Code

Description
This filter allows the max file size for imported Chained Select files to be controlled.
Usage
1add_filter( 'gform_chainedselects_max_file_size', 'your_function_name' );

Parameters

$size int
The max file size in bytes

Examples
1234add_filter( 'gform_chainedselects_max_file_size', 'set_size' );function set_size( $size ) {    return 2000000; //2mb}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFChainedSelects::get_max_file_size() in gravityformschainedselects/class-gf-chainedselects.php.

gform_chainedselects_import_file

gform_chainedselects_import_file

DescriptionUsageParametersExamplePlacementSource Code

Description
This filter allows an import file for the Chained Selects to be provided programmatically. This import file will override any previously uploaded file via the field settings.
Usage
The following would apply to all forms:
add_filter( 'gform_chainedselects_import_file', 'your_function_name', 10, 3 );

To target a specific form, append the form id to the hook name. (format: gform_chainedselects_import_file_FORMID)
add_filter( 'gform_chainedselects_import_file_14', 'your_function_name', 10, 3 );

To target a specific field id for a form, append the form id and field id to the hook name. (format: gform_chainedselects_import_file_FORMID_FIELDID)
add_filter( 'gform_chainedselects_import_file_14_2', 'your_function_name', 10, 3 );

Parameters

$import_file array
An array of details for the file from which choices will be imported:

$url string The URL of the file to be imported.
$expiration int The number of seconds until the import file will be re-imported.

$form Form Object
The form object.

$field Field Object
The field object.

Example
add_filter( 'gform_chainedselects_import_file', 'set_import_file', 10, 3 );
function set_import_file( $import_file, $form, $field ){
$file_array = array(
'url' => 'http://localhost/wp.dev/wp-content/plugins/gravityformschainedselects/sample.csv',
'expiration' => 60
);
return $file_array;
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GF_Chained_Field_Select::maybe_import_from_filter() in gravityformschainedselects/includes/class-gf-field-chainedselect.php.