Please I am using formio to create a form, within the form two fields (currency) are to be added and a total is to be generated in a field called total.
I have tried adding this custom javascript code in the calculated value section to the total field
value= data.value1 + data.value2;
I also tried value = parseInt(data.value1) + parseInt(data.value2);
I have run into this issue before. For some reason, setting the value does not display it in the field itself. What worked for me was using
calculateValueby editing the JSON for the field. To do this:Click on the Edit JSON button for the field.
Add the following code to add the values from the previous fields, where
num1andnum2are your unique keys:References:
https://jsonlogic.com/
https://formio.github.io/formio.js/app/examples/calculated.html