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

Further issues with form functions!

claramitsahne
Registered: Nov 10 2008
Posts: 31
Answered

I am attempting to set the following function in an acrobat form.

The client has requested that the following calculation occurs only when the 'calculate button' is clicked.

I already have the button partly working. It divides the amount in field 'A' by 52 and displays the answer in field 'B'. But what i need this time as follows:
Field A divided by 52 = Field B, then all the subsequent fields to be added together

ie:
Field A: 5,200 (/52)
Field B: 100
Field C: 200
Field D: 300
Field E: 400

Then I also need a tick box to deactivate this function so that the result in Field B is constant throughout the entire form.

ie:
Field A: 5,200 (/52)
Field B: 100
Field C: 100
Field D: 100
Field E: 100

Is this possible? Can anybody point me in the right direction?
C

My Product Information:
Acrobat Pro 8.1.2, Macintosh
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
You probably do not need a function, just some a custom JavaScript to perform the calculation. You would use a function if you used the code for this button more than once.

this.getField("Field B").value = Number(this.getField("Field A").value) / 52;this.getField("Field F").value = (1 * this.getField("Field C").value) + (1 * This.getField("Field D").value + (1 * this.getField("Field E").value);

George Kaiser

claramitsahne
Registered: Nov 10 2008
Posts: 31
I have tried this but it doesn't seem to be working.

Should this code be applied in the Actions part of my 'calculate' button? or that of the tick box?
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
I would put the code in the "Mouse Up" button action so that the button works like the standard buttons and allows one to cancel the action by keeping the button depressed and dragged off the button.

Rembmer you may need to change the field names.

George Kaiser

claramitsahne
Registered: Nov 10 2008
Posts: 31
Thanks gkaiseril
I'm trying that now