gpld_after_set_min_date (JS)
Description
Do something after the minimum date has been set for a Date field.
Usage
gform.addAction( 'gpld_after_set_min_date', 'my_custom_function' );
Parameters
input jQuery
The current Date input.
date Date
The minimum date that was set.
selectedDate Date
The date selected in another Date field on which the current Date field’s minimum 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.0.18.
Examples
Populate the New Minimum Date into Linked Date Field
/**
* Gravity Perks // Limit Dates // Populate the New Minimum Date into Linked Date Field
* https://gravitywiz.com/documentation/gravity-forms-limit-dates/
*
* When Field B's minimum date is dependent on the selected date in Field A,
* automatically populate the minimum date into Field B.
*
* Instructions:
*
* 1. Install this snippet with our free Custom JavaScript plugin.
* https://gravitywiz.com/gravity-forms-code-chest/
*/
gform.addAction( 'gpld_after_set_min_date', function( $input, date ) {
$input.datepicker( 'setDate', date );
} );
Automatically Show Datepicker for Linked Date Field (Minimum Date)
/**
* Gravity Perks // Limit Dates // Automatically Show Datepicker for Linked Date Field (Minimum Date)
* https://gravitywiz.com/documentation/gravity-forms-limit-dates/
*
* When a date selected in Field A modifies the minimum 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 this snippet with our free Custom JavaScript plugin.
* https://gravitywiz.com/gravity-forms-code-chest/
*/
gform.addAction( 'gpld_after_set_min_date', function( $input, date ) {
$input.datepicker( 'show' );
} );