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

Pro 9 Forms ,performing multiple calc in a form field with javascript

needtechadvice
Registered: Jan 24 2010
Posts: 11

Hi,
I'm using adobe acrobat pro 9 to create data forms.
Unfortunately the program, pro 9, does not have a drop down box to select mutiple or a string of calculations in a single field. ( it does allow simple sum and product calculations but not division or a combinations of calculations in a single field)

The calculation I need to perform is to take the sum of a field and divide that sum by 365 and then mutiply it by another field in the form.
for example the formula in excel looks like this: = D13/365*D15.
Adobe does let you creat a custom java script to perform a similar function but I dont know the correct javascrip code to perform the calculation.

Can you help me formulate the correct java script?

Thank you for your help

My Product Information:
Acrobat Pro 9.2, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
event.value = (this.getField("D13").value/365)*this.getField("D15").value

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

needtechadvice
Registered: Jan 24 2010
Posts: 11
Thank you try67
I used the code as follows: event.value = (this.getField(totalrevatrisk).value/365)*this.getField(days).value. Unfortunately it didnt work. value was not calculated in the open field.
Do you have any other suggestions :)
Thanks again
try67
Expert
Registered: Oct 30 2008
Posts: 2398
You did not add quotes around the names of your fields.

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

needtechadvice
Registered: Jan 24 2010
Posts: 11
Thank you Try67.
I re input code as: = (this.getField("totalrevatrisk").value/365)*this.getField("days").value and I'm getting a sytax error
1: at line 2
Can you still help me with this?
I appreciate your reply and thanks again for all your help.
try67
Expert
Registered: Oct 30 2008
Posts: 2398
event.value = (this.getField("totalrevatrisk").value/365)*this.getField("days").value

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

needtechadvice
Registered: Jan 24 2010
Posts: 11
ok...
event.value = (this.getField("totalrevatrisk").value/365)*this.getField("days").value.
This code was entered into the empty text field properties (text field name is Probable Loss of Income (with no spaces in field name)). Code is not rejected but calculation does not apear in the filed on the form under preview.
Thanks again for all your patience. I'm a total noob at this.
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Maybe you should post the file.

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

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
You are aware that there are 2 ways to design forms with Acrobat Professional?

The is the Adobe Forms tools within Acrobat and this method uses Acrobat JavaScirpt.

Then there is LiveCycle Designer that uses FormCalc and another variation of JavaScript. The forms created by LiveCycle Designer are usable by Acrobat/Reader but the internals are different.

Can you clarify as to which program you are creating your forms in?

There are many basic tutorials and other educational resources on this site that may help you learn how to create forms.

George Kaiser

needtechadvice
Registered: Jan 24 2010
Posts: 11
Thank you again for all your patience.
I would really like to resolve this.
If you send me a link or email I can send you the document .

Then I select the field to edit named Probable Loss of Income (with no spaces in field name)).
Then I double click and go into the properties of the field. Then I select the Calculate Tab and under the Custom calculate script I enter the code. However When I preview the form the Field, Probable Loss of Income does not calculate the total.
try67
Expert
Registered: Oct 30 2008
Posts: 2398
You can upload it to Acrobat.com, or send it to my email (there's a link to the left <--- )

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