Create a sum with text field

Automatically calculate the sum of two numeric text fields in a form.

Overview

The form requires a dynamic total to be displayed without manual calculation.
Use the built-in calculator widget by configuring a hidden field and setting the 'onchange' events of the numeric fields to add to it, or implement custom JavaScript for client-side addition.

Answered
ChronoForms v6
Le LeadershipBC 17 Oct, 2018
Hello! I have 2 text fields type numeric and I want to show the total result automatically. Is it possible with chronoforms? Do you have any tutorial about this?

Regards,
Gr GreyHead 18 Oct, 2018
Answer
Hi LeadershipBC ,

You can use JavaScript to add the results and display them in the form, you need to write a function to do the addition then you can trigger that from the events tab in the form input elements.

And/or you can use PHP in the form On Submit event to do the addition after the form submits (it might be best to do this even if you have a client side addition so that you can confirm the result).

Bob
he healyhatman 18 Oct, 2018
You could also use the in-build calculator widget.

You will need a hidden field - let's assume you call it "calc"
In each of your numeric fields, under events you need onchange->add to -> calc

Then you need the calculator widget, put it wherever you want it displayed, and fill in the required options fields.
This topic is locked and no more replies can be posted.