gpld_after_set_max_date

  1. Description
  2. Usage
  3. Parameters
  4. Since
  5. Examples
    1. Populate the new maximum date into the field.
    2. Automatically show datepicker for linked Date field.

Description

Do something after the maximum date has been set for a Date field.

Usage

gform.addAction( 'gpld_after_set_max_date', 'my_custom_function' );

Parameters

  • input jQuery

    The current Date input.

  • date Date

    The maximum date that was set.

  • selectedDate Date

    The date selected in another Date field on which the current Date field’s maximum date is dependent.

  • fieldId int

    The ID of the current Date field.

  • formId int

    The ID of the current form.

  • data object

    All Limit Dates data for the current form.

Since

This action is available since Gravity Forms Limit Dates 1.1.4.

Examples

Populate the new maximum date into the field.

When Field B’s maximum date is dependent on the selected date in Field A, automatically populate the maximum date into Field B.

/**
 * Gravity Perks // Limit Dates // Populate the New Maximum Date into Linked Date Field
 * https://gravitywiz.com/documentation/gravity-forms-limit-dates/
 *
 * When Field B’s maximum date is dependent on the selected date in Field A,
 * this snippet will automatically populate the maximum date into Field B.
 *
 * Instructions:
 *   1. Install our free Custom Javascript for Gravity Forms plugin.
 *      Download the plugin here: https://gravitywiz.com/gravity-forms-code-chest/
 *   2. Copy and paste the snippet into the editor of the Custom Javascript for Gravity Forms plugin.
 */
gform.addAction( 'gpld_after_set_max_date', function( $input, date ) {
	$input.datepicker( 'setDate', date );
} );

Automatically show datepicker for linked Date field.

When a date selected in Field A modifies the maximum date in Field B, automatically open the datepicker in Field B after the date has been selected in Field A.

/**
 * Gravity Perks // Limit Dates // Automatically Show Datepicker for Linked Date Field (Maximum Date)
 * https://gravitywiz.com/documentation/gravity-forms-limit-dates/
 *
 * When a date selected in Field A modifies the maximum date in Field B,
 * this snippet will automatically open the datepicker in Field B after
 * the date has been selected in Field A.
 *
 * Instructions:
 *   1. Install our free Custom Javascript for Gravity Forms plugin.
 *      Download the plugin here: https://gravitywiz.com/gravity-forms-code-chest/
 *   2. Copy and paste the snippet into the editor of the Custom Javascript for Gravity Forms plugin.
 */
gform.addAction( 'gpld_after_set_max_date', function( $input, date ) {
	$input.datepicker( 'show' );
} );