-
Notifications
You must be signed in to change notification settings - Fork 92
gpld-populate-new-minimum-date-into-linked-date-field.js: Fixed an issue with default value of field not getting used to apply minimum date.
#1099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
8f8a375
59cc849
d44d244
1440cb6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,6 +10,17 @@ | |||||||||||||||||||||||||||||||||||
| * 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 ); | ||||||||||||||||||||||||||||||||||||
| const sourceFieldId = 25; // Replace with the ID of the source field (Field A) | ||||||||||||||||||||||||||||||||||||
| document.addEventListener( 'gform/post_render', ( event ) => { | ||||||||||||||||||||||||||||||||||||
| const $field = jQuery( `#input_GFFORMID_${sourceFieldId}` ); | ||||||||||||||||||||||||||||||||||||
| const value = $field.val(); | ||||||||||||||||||||||||||||||||||||
| if ( value ) { | ||||||||||||||||||||||||||||||||||||
| requestAnimationFrame( function(){ | ||||||||||||||||||||||||||||||||||||
| $field.trigger( 'input' ).trigger( 'change' ); | ||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
| const value = $field.val(); | |
| if ( value ) { | |
| requestAnimationFrame( function(){ | |
| $field.trigger( 'input' ).trigger( 'change' ); | |
| }); | |
| } | |
| const $field = jQuery( `#input_GFFORMID_${sourceFieldId}` ); | |
| if ($field.length === 0) { | |
| console.error(`Source field with ID ${sourceFieldId} not found. Please check the field ID.`); | |
| return; | |
| } | |
| const value = $field.val(); | |
| if ( value ) { | |
| requestAnimationFrame( function(){ | |
| $field.trigger( 'input' ).trigger( 'change' ); | |
| }); | |
| } |
Uh oh!
There was an error while loading. Please reload this page.