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

Java Calculations - Zero

DesireeH
Registered: Mar 4 2010
Posts: 5

I have a series of fields that the person viewing the form would fill in. When these fields are filled in there are a number of fields below that calculate all of this information. However, one of my fields is giving me an error when the form is cleared, because it creates a zero and the calculation is then not correct. What do I need to enter in the simplified field notation to correct this problem?

Here is the calculation: (field1/field2)*field3*field4

The error states that - "the value entered does not match the format of the field"

When there is no numbers in the above boxes I'd like the calculation box to read $0.00 like my other calculation boxes.

Thanks.

My Product Information:
Acrobat Pro 9.0, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Maybe, just maybe, the empty field is being treated like it has zero for a value.

What do you think will happen when you divide by zero?

You can not use the simplified field notation for calculations involving zero, unless you default the field to a none zero value and know your divisor will never have a zero value, so you will need to write a custom calculation script. [url=http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=24626]Division[/url]

George Kaiser

DesireeH
Registered: Mar 4 2010
Posts: 5
This is all new to me as I just learned about JavaScript yesterday. Would I enter that into the blank fields that info is imputed into or into my calculation fields? What would it look like?
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Did you look at the linked post. Click on [url=http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=24626]Division[/url]

George Kaiser

DesireeH
Registered: Mar 4 2010
Posts: 5
I got it to work using this...

if(this.getField("text4").value!=='')
{event.value=(this.getField("text1").value/this.getField("text2").value)*this.getField("text3").value*this.getField("text4").value; }