How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Russell H. Your Own Question

Russell H.
Russell H., Programmer & Coder
Category: Programming
Satisfied Customers: 9514
Experience:  Programmer & Coder
13568747
Type Your Programming Question Here...
Russell H. is online now
A new question is answered every 9 seconds

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: 1 year ago.
Category: Programming
Customer: replied 1 year ago.
Here is the exact calculation I need coded, I have 3 form fields
1. Number of Patients
2. Total Re-admissions
3. Percentage of Re-admissions
I need the Percentage of Re-admissions to be the exact percentage of fields 1 and 2 so for exampleNumber of Patients = 10
Total Re-admissions= 5
Percentage of Re-admissions = 50%
Expert:  Russell H. replied 1 year 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 1 year 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
2. Total Re-admissions
3. Percentage of Re-admissions
I need the Percentage of Re-admissions to be the exact percentage of fields 1 and 2 so for exampleNumber of Patients = 10
Total Re-admissions= 5
Percentage of Re-admissions = 50%
Expert:  Russell H. replied 1 year 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 1 year 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 1 year 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 1 year 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 1 year 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 1 year 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.

Related Programming Questions