This module is available for download from the HubSpot Template Marketplace.
It can be used with any Sprocket Rocket Product
It can be used with any Sprocket Rocket Product
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
- 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)
, whereprincipal
,r
, andn
are the input field IDs.
Supported Operations
- 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.
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.
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.