Forums

Create a sum with text field

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,
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
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.