View Live

Calculator

The Calculator module is a user-friendly tool designed to simplify complex calculations and provide accurate results in real-time. This documentation will guide you through the process of adding form fields, performing calculations, and customizing the functionality of the Calculator module.

Adding Form Fields 

To add form fields for user input, follow these steps: 

  • Locate the Inputs repeater in the module settings.
  • Within the repeater, add a new row to represent each form field.
  • Assign a unique ID to each field. This ID will be used to reference the input value during calculations.
  • Specify a default value for the field, if applicable.
  • You can also include a prefix or suffix to enhance the user experience, such as currency symbols or units.

Performing Calculations

  1. The Calculator module allows you to define and perform calculations based on the user inputs. To set up calculations, follow these steps:
  • Find the Outputs repeater within the Results group in the module settings.
  • Add a new row to the repeater for each calculation you want to perform.
  • Assign a unique ID to each result field.
  • In the "Calculation" field of each row, enter the formula to calculate the desired result. Refer to the input IDs defined earlier to include them in the formula.
    Example: To calculate the interest on a principal amount, use the formula: principal * r * (1 + r)**n / ((1 + r)**n - 1), where principal, r, and n are the input field IDs.

Supported Operations

  1. The Calculator module supports various mathematical operations, allowing you to create diverse calculations. Here are the supported operations:
  • Addition: Use the + symbol.
  • Subtraction: Use the - symbol.
  • Multiplication: Use the * symbol.
  • Division: Use the / symbol.
  • Modulus (remainder): Use the % symbol.
  • Exponentiation: Use ** to raise a value to a power.
  • IF: This expression checks if A equals 1; if it does, the result will be the value from B; otherwise, the result will be the value from C
    (A == 1) ? B : C or (A == "CAN_BE_A_STRING") ? B : C

Background Calculations

You can perform calculations in the background without displaying the results. This feature is useful when you want to use the calculated values later without showing them to the user. To enable background calculations:
  • Locate the desired result field in the Outputs repeater.
  • Check the "Hidden" checkbox for that field.

Send Results to HubSpot:

You can send the Input and Outputs to a HubSpot form by creating fields that correspond to your Input/Outputs

  • Create Matching Fields: In your HubSpot form, create fields that match the inputs and outputs you wish to send.

  • Configure Call to Action: In the Results section, set the Call to Action to Open Form and choose the relevant form from your list.

  • Enable Data Transfer: For each input or output, check the Send to HubSpot Form option and enter the corresponding HubSpot field name.

  • Hide Form Fields: If you prefer not to display certain fields to users, you can set these form fields to be hidden within the HubSpot form settings.

Customization

The Calculator module offers customization options to align with your branding and specific requirements. You can customize the appearance and styles in the module's Style tab Customize the colors, fonts, and overall design to match your website theme.

See it Live