how show a calculated field when open form and read data

How to display a calculated field when loading a form with existing data.

Overview

The issue occurs because direct mathematical operations within ChronoForms special field placeholders are not processed correctly.
Instead of using placeholders for calculations, add the calculation logic either within the database query or via Custom PHP code to compute the value and inject it into the form data.

Answered
ChronoForms v7
ec economyweb 19 Oct, 2021
Answer
>Hello
I would like to know how can I to show a value in a text field ONLOAD a form.
The form read database customers and show "price field" and "tax field" with values and I want to show a third field with the sum of price and tax...

in read database there is a option "special Field" where you can put:
model.basic_price = {data.model.price} and show it
but if you put {data.model.price}+{data.model.tax} or {data.model.price}*2
chronoforms show -> *2
Gr GreyHead 09 Dec, 2021
Hi economyweb,

You can either add the calculation into the Database query (though I'm not sure that CFv7 supports that); or you can use Custom PHP to do the calculation and add the result to the form data so it will be shown along with the other data.

Bob
This topic is locked and no more replies can be posted.