These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Calculated field results displaying before information is added

JayMack75
Registered: Mar 18 2010
Posts: 7

I am building a sheet which will allow me to calculate payments for my clients. My problem is that I have entered the code to calculate the fields when the data is entered, but the "balance" amount shows on all of the remaining empty fields, even though I have not entered the "payment amount" for them.

I may be confusing, so I'll do my best to replicate it on here:

Date | Payment Value | Balance
| Balance
| Balance
| Balance
| Balance

I only want the balance to display after a payment value has been entered. Can someone please help? Is it something that I may need to change in the JavaScript? If so, I'm pretty much ignorant on how to program it.

try67
Expert
Registered: Oct 30 2008
Posts: 2398
You probably gave all of them the same name. Each field needs to have a unique name, or they will all have the same value.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

JayMack75
Registered: Mar 18 2010
Posts: 7
No, they all have unique names to each field. I've calculated them using this code:

event.value = this.getField("Number1").value - this.getField("Number 2").value;

I found something that seems to be what I am looking for to rectify my problem, however I can not get it to work. Maybe you could help with it?

The code I found:

if (NumericField1 > 0) then
NumericField1 * 10;
$.presence = "visible";
else
0;
$.presence = "invisible";
endif

I only want "Number2" to appear (or be visible) if there is a value in "Number1"
JayMack75
Registered: Mar 18 2010
Posts: 7
I know that the above code only deals with one number, but I dont have any idea how to add the second number and still have the code work effectively. The above code also gives the product of the number, and I am looking for the difference of two numbers.

I basically need this and do not understand how to turn it into code:

Number1 - Number2 with the difference only being visible if number1's value is greater than 0.
JayMack75
Registered: Mar 18 2010
Posts: 7
Anyone have any suggestions?