We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
gpppw-capture-count-as-field-value.js
1 parent 7808a1c commit d6e5edfCopy full SHA for d6e5edf
gp-pay-per-word/gpppw-capture-count-as-field-value.js
@@ -9,6 +9,13 @@
9
* [1]: https://gravitywiz.com/gravity-forms-code-chest/
10
*/
11
gform.addFilter( 'gpppw_word_count', function( wordCount ) {
12
- // Update "4" to the ID of the field which should be populated with the word count.
13
- $( '#input_GFFORMID_4' ).val( wordCount ).change();
+ // Update "2" to the ID of the field which should be populated with the word count.
+ var $field = $( '#input_GFFORMID_2' );
14
+
15
+ // Only update if value is actually different
16
+ if ( $field.val() != wordCount ) {
17
+ $field.val( wordCount ).change();
18
+ }
19
20
+ return wordCount;
21
}, 11 );
0 commit comments