gform/products/product_field_changed

Description

JavaScript event that triggers when any pricing field is modified.

Note: This event replaces the gform_price_change filter.

Usage

document.addEventListener( 'gform/products/product_field_changed', function( event, formId, fieldId ) {
           // Custom logic here.
});

Parameters

  • data Javascript Object
    • event event
      The event that triggered the price change.
    • formId int
      The ID of the form.
    • fieldId int
      The ID of the field.

Examples

Show an alert when the price is updated in a field.

document.addEventListener( 'gform/products/product_field_changed', function( event, formId, fieldId ) {
                if (event.detail.fieldId == 1) {
                      alert('Price updated');
               }

});

Placement

Your code snippet can be placed in an HTML field on your form or in a theme custom JavaScript file.

See also the JavaScript/jQuery section in this article: Where Do I Put This Code?

Source Code

This filter is located in assets/js/src/theme/fields/product/products.js

Since

The event was added in Gravity Forms 2.9.1