gform/post_init

Description

The gform/post_init event is triggered once a form is fully initialized and all necessary scripts are loaded. This event is intended for use by add-ons that depend on core scripts. It fires once per form and provides the form ID as a parameter.

Usage

document.addEventListener( 'gform/post_init', ( event ) => {
 // Custom logic here
} );

Parameters

  • formID int
    The id of the form.

Examples

Show an alert message

// Show an alert  message
document.addEventListener( 'gform/post_init', ( event ) => {
    alert( 'post init fired.' + event.detail.formId );
} );

Placement

Reference the article Adding JavaScript Code to the Frontend of Your Site.

Source Code

This event is located in gravityforms.js.

Since

The filter was added in Gravity Forms 2.9.0

OSZAR »