Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions experimental/gf-recalculate-on-image-wrapper-click.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Gravity Perks // Gravity Forms // Trigger calculations on click of image for Image Choice
* https://gravitywiz.com/
*
* This snippet is needed to work around a bug in Gravity Forms 2.9 where calculations are not
* re-processed when the actual image of an Image Choice is clicked. It works fine if you click on
* the label or the checkbox/radio itself.
*
* Instructions:
*
* 1. Install this snippet with our free Custom JavaScript plugin.
* https://gravitywiz.com/gravity-forms-code-chest/
*/
$( '#gform_GFFORMID input:checkbox, #gform_GFFORMID input:radio' ).on( 'change', function (event) {
var $target = $( event.target );
if ( !$target.closest( '.gfield-image-choice-wrapper-inner' ).length ) {
return;
}

var _GFCalc = rgars( window, 'gf_global/gfcalc/{0}'.gformFormat( GFFORMID ) );
_GFCalc.runCalcs( GFFORMID, _GFCalc.formulaFields );
});
Loading