# How to use gform\_calculation\_result filter with trigger functions?

**URL:** https://community.gravityforms.com/t/how-to-use-gform-calculation-result-filter-with-trigger-functions/9708
**Category:** Get Help
**Tags:** gform\_calculation\_result
**Created:** [June 6, 2021, 9:39pm UTC](https://community.gravityforms.com/t/how-to-use-gform-calculation-result-filter-with-trigger-functions/9708 "2021-06-06T21:39:01Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![user60acc28bb32d6018](https://avatars.discourse-cdn.com/v4/letter/u/f0a364/32.png) [@user60acc28bb32d6018](https://community.gravityforms.com/u/user60acc28bb32d6018)
#### Post date: [June 6, 2021, 9:39pm UTC](https://community.gravityforms.com/t/how-to-use-gform-calculation-result-filter-with-trigger-functions/9708/1 "2021-06-06T21:39:01Z")

</div>

Hello, my programming skills are very basic. I have searched the forum for the answer to my problem and I have not been able to find a good solution.

It is about finding a way to use the filter “gform\_calculation\_result” in combination with other functions that allow to automatically activate the calculations:  
“jQuery(document).ready(function(){}”  
and  
" jQuery(’#input’).on(‘change’,function (){}"

If for example I use:

```
    jQuery(document).ready(function(){
	jQuery('#input_1).on('change',function (){
	      
		result //calculation result
	});
	});
	
	gform.addFilter('gform_calculation_result', function( result, formulaField, formId, calcObj ) {
	  	if ( formId == '217' && formulaField.field_id == '3' ) {

			result = ;

		}
	return result;
	} );

```

The filter works but I can’t use the result of the calculations in the filter because it is contained in the previous function.

And if I use

```
gform.addFilter('gform_calculation_result', function( result, formulaField, formId, calcObj ) 
	jQuery(document).ready(function(){
	jQuery('#input_).on('change',function (){
	
		calculation
		
	});
	});
	
	return result;	
	});

```

Don´t work.  
I have tried other combinations to place “Filter” with “jQuery (document) .ready (function () {” with “jQuery (’# input \_). On (’ change ', function () {” but I have not found a way that everything works well to the time.

For example, In a theoretical case like this (in real case the calculations would be much more complex and only possible with JS), How could it be used the filter?

“gform.addFilter(‘gform\_calculation\_result’, function( result, formulaField, formId, calcObj )” to save the result in field id = 3

```
    jQuery(document).ready(function(){
    jQuery('#input_217_1,#input_217_2').on('change',function (){		

 a = jQuery('#input_217_1').val();  
 b = jQuery('#input_217_2').val();  		
	
	result = a*b;

  return result;
 });
});	

```

Thanks in advance

---

<div class="post-metadata">

### Author: ![richardw8k](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/richardw8k/32/2354_2.png) [@richardw8k](https://community.gravityforms.com/u/richardw8k)
#### Post date: [January 5, 2022, 8:33am UTC](https://community.gravityforms.com/t/how-to-use-gform-calculation-result-filter-with-trigger-functions/9708/2 "2022-01-05T08:33:10Z")

</div>


