Copy link to clipboard
Copied
Hello I am a beginning to both Adobe and Java.
I am trying to do the division of two fields = S5totalotherrev / S5MealequivalentRate
However, both fields are blank until the user enters data, which I discovered returns an error. So after reading some of the others posts, I wrote the following script: (note I'm only doign the check on S5MealequivalentRate because the data isn't entered until later in the form and I didn't know how to write it to check both)
Var nRate = this.getField(“S5MealequivalentRate”).value;
If(nRate !=0){event.value = this.getField(“S5totalotherrev”).value / nRate;} else {event.value = “”;}
I'm getting a syntax error and since I basically have no clue when it comes to Java I don't know what I did wrong.
Can someone help me with this script?
Thanks
Use the character ", not “
Use var, not Var
Use if, not If
Info: Acrobat uses Javascript, not Java
Copy link to clipboard
Copied
Use the character ", not “
Use var, not Var
Use if, not If
Info: Acrobat uses Javascript, not Java
Copy link to clipboard
Copied
Okay I switched it, but I'm still getting an error.
Copy link to clipboard
Copied
You probably didn't fix all errors.
var nRate = this.getField("S5MealequivalentRate").value;
if(nRate !=0){event.value = this.getField("S5totalotherrev").value / nRate;} else {event.value = "";}
Copy link to clipboard
Copied
Thank you. That worked. This is so confusing when you don't understand it.