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

Miscalculation of form fields

lamoose
Registered: Apr 14 2009
Posts: 10
Answered

I have a few problems with the form I created.

My form has many fields, rows and columns.

example:

row 1: entervalue1 entervalue2 entervalue3 addvalues 10%values
row 2: entervalue1b entervalue2b entervalue3b addvaluesb 10%values
total total total total total

My form has many more rows and columns. At first glace when I type in values everything seems correct but i can spot 2 problems so far. when I go back and change a value sometimes the calculation doesn't refresh. And 2 if I skip a field it adds really weird. ex: 10 + 10 + 10 + blank + 10 = 3010

I have been reading the forms and noticed I needed to make sure the calulation order was correct. I set the calculation order like this: row1 left to right then row2 left to right then left to right on the totals. I am still experiencing problems. Any ideas?

My Product Information:
Acrobat Pro 8.1.2, Macintosh
lamoose
Registered: Apr 14 2009
Posts: 10
here is an example of a couple of the scripts:

var a = this.getField("E1").value;
var b = this.getField("E2").value;
var c = this.getField("E3").value;
var d = this.getField("E4").value;
var e = this.getField("E5").value;
var f = this.getField("E6").value;
var g = this.getField("E7").value;
var h = this.getField("E8").value;
var i = this.getField("E9").value;
var j = this.getField("E10").value;
var k = this.getField("E11").value;
var l = this.getField("E12").value;
var m = this.getField("E13").value;
var n = this.getField("E14").value;
var o = this.getField("E15").value;
var p = this.getField("E16").value;
var q = this.getField("E17").value;
var r = this.getField("E18").value;
var s = this.getField("E19").value;
var t = this.getField("E20").value;
var u = this.getField("E21").value;
var v = this.getField("E22").value;

event.value = a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r + s + t + u + v;

if (event.value==0)
event.target.display=display.hidden
else event.target.display=display.visibleand another::

var h = this.getField("H5").value;

event.value = h * .10;

if (event.value==0)
event.target.display=display.hidden
else event.target.display=display.visible
lamoose
Registered: Apr 14 2009
Posts: 10
ok, it seems the problem is if there is a blank value for a field I'm adding. How should I take into acount that one of the field may be blank that I'm adding?

How do I make the value 0 if nothing is entered and not have to put a 0 in that field?
lamoose
Registered: Apr 14 2009
Posts: 10
ok I think I solved the problem. this post answers the problem about blank values

http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=19218
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
The problem lies with JavaScript not be strict about data types and its automatic assumtions as to how to handle different or appearing different data types. A "Null" form field could be considered to be a numeric null or zero or a null character string or empty character string and when in a mixed series the null value is treated like a character string.

George Kaiser

lamoose
Registered: Apr 14 2009
Posts: 10
Creating forms in Acrobat is very time consuming, Is Live Cycle any better?

Mainly cause you have to edit, change and write code for every single field. no short cuts.