Adobe JavaScript or simplified field to add, multiply several fields to retrieve amount
I am running Adobe Pro v. 2022.003.20282 and working on a form (Text Boxes) to pull data from a second sheet. Problem is I cannot find the right formulas to make what I want to do happen. I am new and don't know anything about this JavaScripting just Googling and I might be asking too much for the system.
basically the formula will see that the TRVL has input their name then look at additional text fields for data to add or multiply for a total dollar amount.
(Hotel parking rate will be multiplied by Hotel parking days) then add (Other 1 amount) then add (Other 2 amount) then add (Other 3 person multiplied by Other 3 number of days) to give me the total dollar amount needed.
Example - one I have tried which is not calculating it correctly
var Tname = this.getField("TRVL 1 Name").valueAsString;
var T1cost = this.getField("Hotel parking rate").valueAsString;
var T2cost = this.getField("Hotel parking days").valueAsString;
var T3cost = this.getField("Other 1 amount").valueAsString;
var T4cost = this.getField("Other 2 amount").valueAsString;
var T5cost = this.getField("Other 3 per person").valueAsString
var T6cost = this.getField("Other 3 number of days").valueAsString;
if(Tname != "")
event.value = (T1cost*T2cost)+T3cost+T4cost+(T5cost*T6cost);
else
event.value = "";
Example 2 - I have tried
event.value = Math.round((this.getField("Hotel total tax").value * this.getField("Hotel parking days"). value)) + this.getField("Other 1 amount"). value + this.getField("Other 1 amount"). value + this.getField("Other 2 amount"). value) + (this.getField("Other 3 per person").value * this.getField("Other 3 number of days"). value));
event.value = "";
Seeing what the pro JavaScript members can come up with to help me out.
Thanks in advance,
Shannon
