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

How to show value based on calculation

nk
Registered: Jan 21 2008
Posts: 15

Hi there,

Newbie to using Javascript to calculate and validate fields.

Having a bit of trouble getting this to work properly. Here's what I'm faced with:

There are 3 fields: [b]AmtPaid[/b], [b]75percentAmtPaid[/b], and [b]AmtReimbursed[/b]

The user enters the [b]AmtPaid[/b] (no maximum number here)

Then 75% of the [b]AmtPaid[/b] is calculated and shown in the [b]75percentAmtPaid[/b] field (still no maximum here).

How do I set the [b]AmtReimbursed[/b] to look at the [b]75percentAmtPaid[/b] value and see if it is 250 or less then if the value is less than or equal to 250 to display the value otherwise show only 250 if the [b]75percentAmtPaid[/b] is value is greater than 250?

I used the Calculate tab to calculate [b]75percentAmtPaid[/b] by using the Simplified field notation to: (AmtPaid)*0.75. This part works fine.

I've tried for the [b]AmtReimbursed[/b] field to use the Validate tab and set the Field value is in range: From 0 To: 250 and have the Calculate tab set the Simplified field notation to: (AmtPaid)*0.75. This creates an error message if I enter a value in the [b]AmtPaid[/b] field equal to or greater than 333.34 (because 75% of 333.33 is 250). The pop-up message says invalid because the value must be between 0 and 250 as soon as I tab from the [b]AmtPaid[/b] field.

Help!!

[i]I'm stumped to figure out the next step.[/i]

My Product Information:
Acrobat Pro 9.3.1, Windows
mmazal
Registered: Jul 20 2009
Posts: 27
For something this complex you will need to use a custom script and use javascript
Custom calculate for AmtReimbursed
try

var ar = getField("AmtReimbursed").value;

if (ar <= 250)
event.value = ar
else
event.value = 250