Skip to content

Commit 6003a86

Browse files
committed
gw-populate-date.php: Updated snippet to tap dynamic content loaded by field value modifier.
1 parent ac13a44 commit 6003a86

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

gravity-forms/gw-populate-date.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,19 @@ public static function output_script() {
300300
self.populateDate( self.sourceFieldId, self.targetFieldId, self.getModifier(), self.format );
301301
} );
302302

303+
// Listen for any dynamic content loaded on modifier field (if existing) to refresh values on Target.
304+
if ( self.modifier ) {
305+
var modifier = self.modifier.inputId;
306+
307+
if ( modifier ) {
308+
var modifierParent = '#field_' + self.formId + '_' + modifier;
309+
var modifierTarget = '#input_' + self.formId + '_' + modifier;
310+
$( modifierParent ).on( 'change', modifierTarget, function() {
311+
self.populateDate( self.sourceFieldId, self.targetFieldId, self.getModifier(), self.format );
312+
} );
313+
}
314+
}
315+
303316
// Listen for GPPA's new `gppa_updated_batch_fields`
304317
$( document ).on( 'gppa_updated_batch_fields', function ( e, formId, updatedFieldIDs ) {
305318
for ( var i = 0, max = updatedFieldIDs.length; i < max; i ++ ) {

0 commit comments

Comments
 (0)