• 100% Satisfaction Guarantee
Russell H., Programmer & Coder
Category: Programming
Satisfied Customers: 11225
Experience:  Programmer & Coder
13568747
Russell H. is online now

# I am using Adobe Acrobat Pro X and I need a javascript

### Customer Question

Hi, I am using Adobe Acrobat Pro X and I need a javascript to calculate a formula for some of my fillable fields.
Submitted: 2 years ago.
Category: Programming
Customer: replied 2 years ago.
Here is the exact calculation I need coded, I have 3 form fields
1. Number of Patients
I need the Percentage of Re-admissions to be the exact percentage of fields 1 and 2 so for exampleNumber of Patients = 10
Expert:  Russell H. replied 2 years ago.
Hi, thank you for contacting JustAnswer.com. My name is Russell. I will do my best to provide the right answer to your question.
Obviously that's a simple piece of programming:
field3 = field2 / field1 * 100;
pretty much, with 'fieldX' referencing whatever the actual name of the field is.
But in context, the problem may be more complex. Let me know what is being displayed in Adobe Acrobat Pro X, if you need further advice or a more complex piece of programming.
Customer: replied 2 years ago.
Ok I'm not sure what you mean but, as in my question, again here are the actual names of the fields;1. Number of Patients
I need the Percentage of Re-admissions to be the exact percentage of fields 1 and 2 so for exampleNumber of Patients = 10
Expert:  Russell H. replied 2 years ago.
OK. Then using those names, the formula runs Percentage of Re-Admissions = Total Re-Admissions / Number of Patients * 100; I think that won't work as JavaScript coding though, since JavaScript does not allow spaces inside variable names or field names. You could use _ (underline characters) instead of spaces, like this, though: Percentage_of_Re-Admissions = Total_Re-Admissions / Number_of_Patients * 100; Would that do?
Customer: replied 2 years ago.
That did not work either, I am adding the code in the text field properties box under the calculate tab. From there I can choose Simplified field notation or custom calculation script. I tried entering that code in both spots and neither work. It does say when entering it uses JavaScripts
Customer: replied 2 years ago.
I can rename the fields if that will make it easier, say 1 2 and 3 as their names.1 would be the Number of Active Patients
2 would be the Total Re-admissions
3 would be the Percentage of Re-admissions
Expert:  Russell H. replied 2 years ago.
OK, according to that: (RETURN character) 3 = 2 / 1 * 100; unfortunately, that wouldn't work. '3' and '2' and '1' are constant values, and can't be used that way. Adding a 'N' to each one would result in (RETURN character) N3 = N2 / N1 * 100;
Customer: replied 2 years ago.
I have changed the names of the fields to N1, N2 and N3. I installed the snippet and it still does not auto calculate.
Customer: replied 2 years ago.
You do not respond quick enough for me, I need this issues answered much faster and accurately. I would like to have my question answered by someone else.