From 42b1f7d0866040043457db7792898a091b1bbcdc Mon Sep 17 00:00:00 2001 From: saifsultanc Date: Thu, 24 Apr 2025 14:10:49 +0530 Subject: [PATCH 1/3] `gw-choice-counter.php`: Fixed an issue with Choice Counter not working for Image Choice field. --- gravity-forms/gw-choice-counter.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gravity-forms/gw-choice-counter.php b/gravity-forms/gw-choice-counter.php index fa949e72..05622271 100644 --- a/gravity-forms/gw-choice-counter.php +++ b/gravity-forms/gw-choice-counter.php @@ -90,7 +90,9 @@ function output_script() { // Event handler for all listeners to avoid DRY and to maintain a pointer reference to the function // which we can use to explicity unbind event handlers self.updateChoiceEventHandler = function() { - self.updateChoiceCount( self.formId, self.choiceFieldIds, self.countFieldId, self.values ); + setTimeout( function() { + self.updateChoiceCount( self.formId, self.choiceFieldIds, self.countFieldId, self.values ); + }, 10 ); // 10ms delay gives DOM time to reflect input change }; self.init = function() { From cfe290d2a8d642b10955fd3d4850874a95ed83ca Mon Sep 17 00:00:00 2001 From: saifsultanc Date: Fri, 25 Apr 2025 17:44:20 +0530 Subject: [PATCH 2/3] `gw-choice-counter.php`: Fixed an issue with Choice Counter not working for Image Choice field. --- gravity-forms/gw-choice-counter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gravity-forms/gw-choice-counter.php b/gravity-forms/gw-choice-counter.php index 05622271..26eca153 100644 --- a/gravity-forms/gw-choice-counter.php +++ b/gravity-forms/gw-choice-counter.php @@ -90,9 +90,9 @@ function output_script() { // Event handler for all listeners to avoid DRY and to maintain a pointer reference to the function // which we can use to explicity unbind event handlers self.updateChoiceEventHandler = function() { - setTimeout( function() { + requestAnimationFrame( function() { self.updateChoiceCount( self.formId, self.choiceFieldIds, self.countFieldId, self.values ); - }, 10 ); // 10ms delay gives DOM time to reflect input change + }); // 10ms delay gives DOM time to reflect input change }; self.init = function() { From eae902523deea89e8995eb1982a83f09c704ab60 Mon Sep 17 00:00:00 2001 From: saifsultanc Date: Fri, 25 Apr 2025 17:44:58 +0530 Subject: [PATCH 3/3] `gw-choice-counter.php`: Fixed an issue with Choice Counter not working for Image Choice field. --- gravity-forms/gw-choice-counter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity-forms/gw-choice-counter.php b/gravity-forms/gw-choice-counter.php index 26eca153..988d81fd 100644 --- a/gravity-forms/gw-choice-counter.php +++ b/gravity-forms/gw-choice-counter.php @@ -92,7 +92,7 @@ function output_script() { self.updateChoiceEventHandler = function() { requestAnimationFrame( function() { self.updateChoiceCount( self.formId, self.choiceFieldIds, self.countFieldId, self.values ); - }); // 10ms delay gives DOM time to reflect input change + }); }; self.init = function() {