Copy link to clipboard
Copied
I need to calculate BSA which is:
Sqrt((Ht*Wt) /3600)
I have tried entering in everything and cannot get it right
The fields I have are HT and WT
I copy and pasted the code into the BSA field and still does not calculate.
Is there anything else I can do?
Thank you so much
Copy link to clipboard
Copied
Let's say you have fields called Ht and Wt. Enter this code as the custom calculation script for the BSA field:
var ht = Number(this.getField("Ht").value);
var wt = Number(this.getField("Wt").value);
if (ht==0 || wt==0) event.value = "";
else event.value = Math.sqrt((ht*wt)/3600);
Copy link to clipboard
Copied
The fields I have are HT and WT
I copy and pasted the code into the BSA field and still does not calculate.
Is there anything else I can do?
Thank you so much
Copy link to clipboard
Copied
Did you adjust the field names in the code? Are there any error messages in the JS Console (Ctrl/Cmd+J) when you change the value of one of the fields?
Copy link to clipboard
Copied
I do not get any error messages.
This is what I entered:
varWT= Number(this.getField(WT).value);
if(HT==0||WT==0)event.value = "";
else event.value = Math.sqrt((HT*WT)/3600)
Copy link to clipboard
Copied
I highly doubt there are no errors messages as I see at least three errors in that code...
Where's the definition of the HT variable?
Where's the space after var in the first line?
Where are the quotes around the field's name in the first line?
Copy link to clipboard
Copied
So what I am wanting to do is create a universal form that has height and weight. Once the height and weight are entered, I would like it to populate the BSA.
one field box I named it: HT
second field box is: WT
and then I have a field box for BSA
I am not sure how to define the the variables when they will change each time a weight or height is changed
Sorry, I am completely new to this
Copy link to clipboard
Copied
I understood that and the code I provided will do it. All you had to do was adjust the names of the fields in it, like this:
var ht = Number(this.getField("HT").value);
var wt = Number(this.getField("WT").value);
if (ht==0 || wt==0) event.value = "";
else event.value = Math.sqrt((ht*wt)/3600);
Don't change anything else!
Copy link to clipboard
Copied
THANK YOU! SO MUCH! That worked perfectly
Find more inspiration, events, and resources on the new Adobe Community
Explore Now