Calculated field in NeetoForm is a powerful widget that allows you to perform real-time calculations based on a user's form inputs. This can be incredibly useful for a variety of applications, from displaying dynamic pricing for your e-commerce form to automatically calculating quiz scores for your quiz forms.
Here are a few popular use cases:
Pricing Calculations: For forms involving product or services, calculated fields can sum up prices to provide an estimated total at checkout, giving users an e-commerce-like experience directly within the form.
Quiz Scoring: If you're conducting online quizzes or assessments, calculated fields can tally correct answers to generate a final score, making the grading process seamless.
Tax or Discount Calculation: Calculated fields can be used to automatically apply tax or discount rates based on specific criteria.
Currently, NeetoForm supports calculated fields for numerical and text based calculations.
How to use calculated fields for numerical calculations
Add a Calculated Field by selecting it from the list of elements.
Configure the Field Settings by assigning a meaningful name like "Score" or "Price", so that it can be referred later.
Under type, select Number.
Specify an initial value, if applicable, which could serve as the starting point for your calculations.
Calculated fields work in tandem with NeetoForm’s conditional logic feature. After adding the calculated field, navigate to the Conditional Logic section from the Configure tab and set up conditions for your calculated field to determine when and how its value should change based on user responses.
NeetoForm supports the following operations for numerical calculations via conditional logic:
Add: Adds a specified value or another field's value to the calculated field.
Subtract: Subtracts a specified value or another field's value from the calculated field.
Multiply: Multiplies the calculated field by a specified value or another field’s value.
Divide: Divides the calculated field by a specified value or another field's value.
Assign: Sets the calculated field to a specific value, regardless of its previous value.
For example, if you have a calculated field as Price, you can perform the following operations.
Add 10 to Price.
Subtract Discount from Price. (Here, Discount is another calculated field).
Multiply Price by Count. (Here, Count is a Number element).
How to use calculated fields for text-based calculations
Add a Calculated Field and configure it as a text-based field.
Assign a name that reflects its purpose, such as "Greeting" or "Custom Message."
Under type, select Text.
Specify an initial value, if applicable, which could serve as the starting point for your calculations.
NeetoForm supports the following operations for text-based calculations:
Assign: Sets the calculated field to a specific text value, replacing any existing content.
Concat: Concatenates two or more text values into one.
Prepend: Adds a specified text value at the beginning of the calculated field's existing content.
Displaying Calculated Values
By default, calculated values are not visible to users within the form. These values can be displayed to the users using the paragraph element. Additionally, calculated fields can be integrated with a payment element, allowing you to accept dynamic payments based on real-time calculations.
On form submission, the calculated value is stored against the submission. You can access these values under the "Submissions" tab.