Developer Docs

Contents

Introduction

We believe in keeping Gravity Forms simple and easy to use, and a lot of thought goes into adding new functionality. Still, users often find the need to add/modify functionality to meet their needs.

This section of the documentation offers guidelines and references for anyone wishing to modify or extend Gravity Forms.

Add-on Developer Docs

Hooks and Filters

Following is a list of available hooks and filters.

Form Loading

The following filters can be used to manipulate the form data before the form gets displayed to the screen. Tasks such as adding drop down items dynamically or pre-populating field values can be accomplished using them.

  • gform_column_input (new in v. 1.6)
    This filter can be used to specify a different input type for a column in a list field. Currently supported field types are "select" (Dropdown) and "text" (Text Field).
  • gform_column_input_content (new in v. 1.6.9)
    This filter can be used to modify the HTML content of the list field column input tag.
  • gform_counter_script
    Use this filter to change the initialization script for the textarea counter script. Can be used to specify different initialization parameters.
  • gform_countries
    This filter can be used to change the list of countries displayed in the address field
  • gform_date_min_year (new in v. 1.6)
    Use this filter to specify the min year displayed in the date field's year drop down
  • gform_date_max_year (new in v. 1.6)
    Use this filter to specify the max year displayed in the date field's year drop down
  • gform_enqueue_scripts
    Use this action hook to enqueue scripts to the page. Useful when creating custom field types that require additional scripts
  • gform_field_content
    Use this filter to specify the contents of a field (label and input). Can be used to change the way an existing field type is displayed or to implement a custom field type. Similar to gform_field_input, but provides more flexibility.
  • gform_field_choices
    Use this filter to manipulate checkbox and radio items. Can be used to allow HTML content to be displayed
  • gform_field_css_class
    Use this filter to change the field's CSS class(es). Useful to dynamically assign a CSS class to a field.
  • gform_field_input
    Use this filter to specify the field's <input> tag. It can be used to change an existing field type or to implement a custom field type
  • gform_field_value_$parameter_name
    Use this filter to add a default value to the field specified by $parameter_name.
  • gform_form_tag
    Use this filter to change Gravity Forms <form> tag.
  • gform_init_scripts_footer
    Use this filter to load scripts in the footer of the site instead of the default location of header.
  • gform_input_mask_script (new in v. 1.6)
    Use this filter to change the initialization script for the input mask script. Can be used to specify different initialization parameters.
  • gform_is_ssl (new in v. 1.6.3)
    Use this filter to set whether or not the current page is running securely (https). Useful when using a proxy server that does not set the $_SERVER['HTTPS'] variable.
  • gform_noconflict_scripts (new in v. 1.6.4)
    Use this filter to add scripts to be enqueued when running Gravity Forms with no-conflict mode enabled. Useful for add-ons that require scripts to be enqueued in the form editor page.
  • gform_noconflict_styles (new in v. 1.6.4)
    Use this filter to add styles to be enqueued when running Gravity Forms with no-conflict mode enabled. Useful for add-ons that require styles to be enqueued in the form editor page.
  • gform_payment_methods (new in v. 1.7)
    Use this filter to add alternative payment methods to the Credit Card field.
  • gform_pre_render
    Use this filter to manipulate the Form Object before the form is displayed.
  • gform_progressbar_start_at_zero (new in v. 1.6.3)
    Use this filter to change the progress bar on multi-page forms to start at zero percent.
  • gform_recaptcha_init_script
    Use this filter to change the look and feel of the reCAPTCHA field beyond what is available in the form admin.
  • gform_shortcode_$action (new in v. 1.6.5)
    Use this filter to allow Add-Ons to implement shortcode actions.
  • gform_submit_button
    Use this filter to change Gravity Forms submit button.
  • gform_next_button
    Allows the markup for the next button to be changed.
  • gform_previous_button
    Allows the markup for the previous button to be changed. See gform_next_button for documentation.
  • gform_tabindex
    Use this filter to specify the tab index start value or to disable the tabindex attribute
  • gform_register_init_scripts
    Tap into Gravity Forms' "initalization scripts" functionality and register your own scripts to run inline with Gravity Forms.

Sublabels

In cases where translating Gravity Forms is not an option, the following filters can be used to change the sublabels of multi-input fields (i.e Name and Address).

Form Submission

The following filters can be used to manipulate the entry data when the user submits the form. Tasks such as integrating with third party systems and dynamic notification routing can be accomplished using them.

Administration

The following filters are fired within the Gravity Forms administration allowing the customization of certain elements.

  • gform_add_field_buttons
    Use this filter to add/remove field type buttons to the form editor screen
  • gform_addon_navigation
    Use this filter to add a sub-menu item under the "Forms" menu.
  • gform_address_types
    Use this filter to add support for a new address type (i.e. another country)
  • gform_admin_pre_render
    Use this filter to manipulate the Form Object before an entry is displayed on the entry detail page in the administration. If you have used gform_pre_render filter to dynamically add items to a drop down field, you may also want to add those items to the entry detail screen to allow administrators to properly edit the entry.
  • gform_after_delete_field
    Use this action hook to perform actions right after a field is deleted from a form.
  • gform_after_delete_form
    Use this action hook to perform actions right after a form is deleted.
  • gform_after_save_form
    Use this action hook to perform actions right after a form is updated or created.
  • gform_after_update_entry
    Use this action hook to perform logic when entries are updated in the admin.
  • gform_author_dropdown_args
    Use this filter to change the author list displayed on post fields. Do that by specifying the $args parameter that will be passed to the wp_dropdown_users($args) to retrieve the author list
  • gform_before_delete_field
    Use this action hook to perform actions right before a field is deleted from a form.
  • gform_before_delete_form
    Use this action hook to perform actions right before a form is deleted.
  • gform_before_resend_notifications (new in v. 1.6.8)
    Use this filter to modify the form object before resending notifications in the admin.
  • gform_choices_setting_title (new in v. 1.6.9)
    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).
  • gform_creditcard_types (new in v. 1.6)
    Use this filter to change the default list of supported credit card types.
  • gform_currency (new in v. 1.6)
    Use this filter to change the currently configured currency.
  • gform_currency_disabled (new in v. 1.6)
    Use this filter to enable/disable the currency drop down on the settings page.
  • gform_currency_setting_message (new in v. 1.6)
    Use this filter to display a message next to the currency drop down.
  • gform_default_notification
    Use this filter to disable the default admin notification created for new forms.
  • gform_delete_lead
    Use this hook to perform actions when an entry is deleted.
  • gform_display_add_form_button (new in v. 1.8)
    Use this filter to display "Add Form" button on pages other than the Post or Page edit pages.
  • gform_editor_js
    This action hook can be used to inject Javascript into the form editor page
  • gform_editor_js_set_default_values
    This action hook can be used to specify default values for field properties when new fields are added to the form.
  • gform_email_fields_notification_admin (new in v. 1.8)
    Use the filter to add/remove fields from the list of email fields that get displayed on the Notification edit page when configuring the "Send To Field".
  • gform_entries_field_value
    Use this filter to change the field's value before getting displayed on the Entry list page. Useful when creating custom field types that require special formatting for the entry list
  • gform_enable_credit_card_field (new in v. 1.6)
    Use this filter to enable/disable the built-in credit card field.
  • gform_enable_password_field
    Use this filter to enable the password field. Useful when developing add-ons that require a password field.
  • gform_entries_column
    Use this action to inject markup to any non-first column of every entry in the entry list grid.
  • gform_entries_column_filter
    Use this filter to inject markup and replace the value of any non-first column in the entry list grid.
  • gform_entries_first_column
    Use this action to inject markup in the first column of every entry in the entry list grid.
  • gform_entries_first_column_actions
    This action hook fires at the end of the action links of every entry in the entry grid list. Useful when adding a custom action link.
  • gform_entries_first_column_actions
    Use this action hook to add extra action links to the entry row on the entry list page.
  • gform_entry_detail (new in v.1.6.4)
    Use this action hook to add extra text to the Entry detail page after the entry details are displayed and before Notes (if visible).
  • gform_entry_detail_content_before (new in v.1.6.8)
    Use this action hook to add extra text/sections before the main content on the Entry detail page.
  • gform_entry_detail_content_after (new in v.1.6.8)
    Use this action hook to add extra text/sections after the main content on the Entry detail page.
  • gform_entry_detail_sidebar_before (new in v.1.6.8)
    Use this action hook to add extra text/boxes before the first box in the Entry detail sidebar.
  • gform_entry_detail_sidebar_middle (new in v.1.6.8)
    Use this action hook to add extra text/boxes in the middle of the sidebars, before the Notifications box (if visible).
  • gform_entry_detail_sidebar_after (new in v.1.6.8)
    Use this action hook to add extra text/boxes after the last box in the Entry detail sidebar.
  • gform_entry_field_value
    Use this filter to change the field's value before getting displayed on the Entry detail page. Useful when creating custom field types that require special formatting when displayed
  • gform_entry_info
    Use this hook to add custom entry information to the Info area on the Entry detail page
  • gform_entry_meta (new in v. 1.7)
    Use this hook to add custom properties to the Entry object. Allows lead meta data to be added as sortable columns to the entry list and export entries file.
  • gform_entry_meta_conditional_logic_confirmations (new in v. 1.8)
    Enables the entry meta conditional logic filters to be modified on the confirmation edit page.
  • gform_entry_meta_conditional_logic_notifications (new in v. 1.8)
    Enables the entry meta conditional logic filters to be modified on the notification edit page.
  • gform_export_field_value (new in v. 1.6.8)
    Use this filter to populate the values for custom columns added to the entry export. Use this in conjunction with the filter gform_export_fields.
  • gform_export_fields (new in v. 1.6.8)
    Use this filter to add custom columns to the entry export. The new fields show in the field selection list. Use this filter in conjunction with the filter gform_export_field_value.
  • gform_export_separator (new in v. 1.6)
    Use this filter to change the column separator character for the entry export file. The default separator is a comma (,)
  • gform_leads_before_export (since v. 1.8)
    Allows entries to be changed before export is executed.
  • gform_field_advanced_settings
    Use this filter to create a new field settings under the Advanced tab. Useful when implementing a new custom field type that requires custom settings.
  • gform_field_type_title (new in v. 1.6)
    When adding a new field type, use this filter to assign a title to the new type.
  • gform_field_standard_settings
    Use this filter to create a new field settings under the Standard tab. Useful when implementing a new custom field type that requires custom settings.
  • gform_filters_pre_results (new in v. 1.8)
    Use this filter to modify the filters used in the drop down list of fields in the admin results pages.
  • gform_filters_get_users (new in v. 1.8)
    Use this filter to control the list of users available in the filters on the entry list, export entries conditional logic and results pages.
  • gform_form_pre_results (new in v. 1.8)
    Use this filter to modify the Form object prior to calculating the results in the results admin pages.
  • gform_get_field_value (deprecated. Use gform_get_input_value instead)
    Use this filter to change the field's value after being retrieved from the database. Use in conjunction with gform_save_field_value to perform low level transformations, such as encrypting/decrypting a field
  • gform_get_input_value
    Use this filter to change the field's value after being retrieved from the database. Use in conjunction with gform_save_field_value to perform low level transformations, such as encrypting/decrypting a field
  • gform_input_masks (new in v. 1.6)
    Use this filter to edit the list of built-in input masks that are displayed in the Text Field input mask setting. Useful when adding a new custom input mask that will be used repeatedly.
  • gform_is_valid_notification_to
    Enables users to change the email validation for the TO address on notification pages. Useful to allow merge tags or shortcodes to be added the TO field.
  • gform_merge_tag_list_exclude (new in v. 1.6)
    Use this filter to exclude field types from the merge tag drop-downs that are displayed throughout the admin pages.
  • gform_post_category_args (new in v.1.8)
    Use this filter to change the $args passed to the wp_dropdown_categories() function and filter the list of categories displayed when "display all categories" is selected in a post category field
  • gform_post_status_options (new in v. 1.7)
    Use this filter to add custom post statuses to the post status drop down on the Properties tab of post fields.
  • gform_print_entry_footer
    Use this action hook to add a custom footer to the print entry screen
  • gform_print_entry_header
    Use this action hook to add a custom header to the print entry screen
  • gform_print_styles
    Use this filter to add custom stylesheets to the print entry screen
  • gform_predefined_choices
    Use this filter to manipulate and/or add new predefined choices to the selection fields (i.e. Checkbox, Drop Down, Multiple Choice)
  • gform_preview_styles
    Use this filter to specify styles to be enqueued on Gravity Forms preview pages
  • gform_product_info
    Use this filter to manipulate the list of products displayed in the entry detail and sent to third party via Add-Ons such as the PayPal Add-On.
  • gform_save_field_value
    Use this filter to change the field's value before saving it to the database. Use in conjunction with gform_get_field_value to perform low level transformations, such as encrypting/decrypting a field
  • gform_settings_menu (new in v. 1.8)
    Use this filter to add/remove tabs to the main settings page.
  • gform_tooltips
    Use this filter to manipulate the tooltips that are displayed throughout Gravity Forms administration pages
  • gform_update_$ENTRY_COLUMN (new in v. 1.6)
    Use this action hook to perform logic when entries are updated.
  • gform_form_actions (new in v. 1.6.2)
    Use this filter to add custom form actions which display below the form title in the Form List view.
  • gform_custom_merge_tags (deprecated in v. 1.7. use Gform_merge_tags)
    Use this filter to add custom merge tags. Custom merge tags will display in Merge Tag drop downs through the Gravity Form admin.
  • gform_entry_page_size (new in v. 1.6.4)
    Use this filter modify how many entries are shown per page in the Entry List view.
  • gform_properties_settings (deprecated in v. 1.7. use gform_form_settings instead)
    Use this filter to create a new form setting under the Properties tab.
  • gform_advanced_settings (deprecated in v. 1.7. use gform_form_settings instead)
    Use this filter to create a new form setting under the Advanced tab.
  • gform_confirmation_settings (deprecated in v. 1.7. use gform_confirmation_ui_settings instead)
    Use this filter to create a new form setting under the Confirmation tab.
  • gform_admin_messages (added in v.1.7)
    Modify update (and other non-error) messages displayed by Gravity Forms in the WordPress admin.
  • gform_confirmation_actions (added in v.1.7)
    Modify the list of actions which display below the Confirmation Name on the Confirmations list view.
  • gform_toolbar_menu (added in v.1.7)
    Modify the links which display in the Gravity Forms Toolbar.
  • gform_pre_confirmation_save (added in v.1.7)
    Modify the confirmation object before it is saved to the database. This is particularly useful when saving custom confirmation settings to the confirmation object.
  • gform_export_menu (added in v.1.7)
    Add new or modify default menu items which will appear in the Import/Export section menu.
  • gform_form_settings (added in v.1.7)
    Add new or modify existing form settings that display on the Form Settings screen.
  • gform_form_settings_menu (added in v.1.7)
    Add new or modify default menu items which will appear in the Form Settings section menu.
  • gform_import_form_xml_options (added in v.1.7)
    Modify the settings used to import a form from an XML export file. Useful when adding your own field types with custom settings stored as an array.
  • gform_menu_position (added in v.1.7)
    Modify the position the Gravity Forms menu should appear in the WordPress admin menu.
  • gform_notification (added in v.1.7)
    Modify a notificaiton object before it is converted into an email and sent.
  • gform_notification_actions (added in v.1.7)
    Modify the list of actions which display below the Notification Name on the Notifications list view.
  • gform_notification_events (new in v.1.7)
    Add a new event to the drop down of available triggers for notifications. Additional code is necessary to handle the event since this hook only adds it to the Event drop down on the notifications admin page.
  • gform_pre_notification_save (added in v.1.7)
    Modify the notification object before it is saved to the database. This is particularly useful when saving custom notification settings to the notification object.
  • gform_webapi_get_users_settings_page (new in v. 1.8)
    Use this filter to control the list of users available to be selected in the “Impersonate account” setting on the API settings page.

Javascript

The following events are fired via jQuery and allow custom client side scripts to be executed.

  • gform_format_option_label
    Use this filter to change the format of the option field labels. Can be used to disable the pricing that is displayed automatically on option fields.
  • gform_post_render (new in v. 1.6)
    Fires every time the form is rendered for AJAX-enabled forms (i.e. going to the next/previous page on multi-page forms, form rendered with validation errors, confirmation message displayed).
  • gform_page_loaded
    Fires on multi-page forms when changing pages (i.e. going to the next or previous page)
  • gform_product_total
    Fires right before updating the Total value on forms with pricing fields. Allows users to manipulate the Total value based on custom logic.
  • gform_load_field_settings
    Fires on the Form Editor page after a field's settings panel has been opened and settings have been displayed.
  • gform_chosen_options
    Fires when a form is loaded and allows you to modify the Chosen jQuery script settings for Drop Down and Multi-Select fields when the "Enable enhanced user interface" is checked.

Other

  • gform_currencies
    This filter allows existing currencies to be modified and new currencies to be created.
  • gform_akismet_enabled (new in v1.6.3)
    This filter allows default Akismet integration to be disabled globally or per form.
  • gform_dashboard_title (new in v1.6.3)
    This filter allows the title of the forms statistics section displayed on the Dashboard to be changed.

Form Object

The Form Object is the main object in Gravity Forms. It contains all properties of a particular form (i.e. form title, fields, notification, scheduling, etc...). This object is available to most of the Gravity Forms hooks above and can be manipulated to change the way the form is displayed, notifications are sent, etc...

It is formatted as an associative array (i.e. $form["title"] retrieves the form title). For details about each property, visit the Form Object page.

Entry Object

The Entry Object contains all properties of a particular entry (i.e. date created, client IP, submitted field values, etc...). It is formatted as an associative array with field ids being the key to get the field data.

$entry["date_created"]; //returns the entry date
$entry["1"];              //returns the value associated with field 1

For details about each property, visit the Entry Object page.

Entry Meta

Entries now support custom meta New with GF v1.6! You can retrieve, update and remove an entry's custom meta using these functions:

Role Management

Gravity Forms introduces new capabilities to the WordPress Role system. For more information, check out the Role Management page.

Search the Documentation