Remove thousand separator from calculation number field

8 0

If you want to remove the thousand separator from a calculation number field, you can do it by creating an HTML field and adding the following snippet:

gform.addFilter( 'gform_calculation_format_result', function(formattedResult, result, formulaField, formId, calcObj ){    
    if ( formulaField.field_id == '11' ){
	formattedResult = gformFormatNumber(result, !gformIsNumber(formulaField.rounding) ? -1 : formulaField.rounding, ',', '');
    return formattedResult;

You need to change the value for formulaField.field_id with the id number of your calculation number field and if you’re using a dot as decimal separator, you’ll need also to update the  ‘,’ after the formulaField.rounding, part with ‘.’

4 observations on “Remove thousand separator from calculation number field
  1. Neil

    Hi Samuel,

    This works perfectly thanks. The field is shown on the page itself without the comma.

    However I’m trying to remove the comma separator and use the field in a query string. For some reason it seems to add the comma back when I do that, IE 1%2C234. Is there any way to modify your code to work on query stings too or is it just me?


    1. Neil

      Actually I think I found my solution on the Gravity forms website. adding this code to my functions.php file solves it

      add_filter( ‘gform_include_thousands_sep_pre_format_number’, function ( $include_seperator, $field ) {
      return $field->formId == 2 && $field->id == 5 ? false : $include_seperator;
      }, 10, 2 );

      Remembering to change the formid and field->id to the correct number.


Leave Your Observation

Your email address will not be published. Required fields are marked *