I am working on a form that needs to calculate the number of packages being ordered. There are 10 packages available. The calculation works correctly when the user orders some of all of the packages, when the user orders just one package, and when the user orders packages in order starting with the first package and without gaps, e.g., orders packages 1, 2, 3 not packages 1,3,5. In the first example, the total comes out correctly as "6". In the second example, the total comes out as "135".
Following is the code:
event.value = (this.getField("# of packages IM").value + this.getField("# of packages IM w 1c").value + this.getField("# of packages IM w 4c").value + this.getField("# of packages IG").value + this.getField("# of packages IG w 1c").value + this.getField("# of packages IG w 4c").value + this.getField("# of packages Pro").value + this.getField("# of packages Pro T").value + this.getField("# of packages BC").value + this.getField("# of packages M").value)
A variation of the same code works perfectly for calculating total cost:
event.value = (this.getField("Total cost of IM").value + this.getField("Total cost of IM w 1c").value + this.getField("Total cost of IM w 4c").value + this.getField("Total cost of IG").value + this.getField("Total cost of IG w 1c").value + this.getField("Total cost of IG w 4c").value + this.getField("Total cost of Pro").value + this.getField("Total cost of Pro T").value + this.getField("Total cost of BC").value + this.getField("Total cost of M").value);
this.getField("Total cost").display = display.hidden;
if (event.value > 0.00)
this.getField("Total cost").display = display.visible
I am not sure why the code works correctly for total cost and not for total packages. Is it because in the case of total packages, the text fields used for the calculation are filled out by the user and in the case of total cost, the text fields used for the calculation are automatically populated based on the users inputs for the number of packages?
This is my first attempt at an Acrobat form and I could really use some help. The rest of the form is working properly.
- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com