Skip to content

Commit

Permalink
gppa-click-image-choice-image-wrapper.js: Added snippet to trigger …
Browse files Browse the repository at this point in the history
…dynamic populate on Image Choice's Wrapper getting clicked.
  • Loading branch information
saifsultanc authored Dec 22, 2024
1 parent a6e4263 commit 30ce736
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions experimental/gppa-click-image-choice-image-wrapper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Gravity Wiz // GP Populate Anything // Trigger GPPA update on Image Choice Wrapper Click.
* http://gravitywiz.com/documentation/gravity-forms-populate-anything
*
* 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.
*/
// If Image Choice's Image Wrapper is clicked, make sure to trigger the `change.gppa` event.
window.gform.addAction(
'gform_input_change',
(elem , formId, fieldId) => {
if (
!$(elem)
.parent()
.hasClass('gfield-image-choice-wrapper-inner')
) {
return;
}
$(elem).trigger('change.gppa');
}
);

0 comments on commit 30ce736

Please sign in to comment.