Copy link to clipboard
Copied
I have a form that requires percentage to be calculated using values input by person filling form.
Text4.0 is no. of attendees
Text4.1 is no. of Employees
Text 4.2 is the percentage calculation
Copy link to clipboard
Copied
For the case of the number of employees being non-zero, I would divide the number of attendees by the number of employees. I would set the field format to the percentage display format and specify the number of decimal places to display. Acrobat JavaScript considers division by zero to result in Not a Number or NaN. One can only use the Custom JavaScript calculation method.
// get computational values;
var nAttendees = this.getField("Text4.0").value;
var nEmployees = this.getField("Text4.1").value;
event.value = 0;
// clear result field;
if(nEmployees != 0){
// compute if divisor not zero;
event.value = nAttendees / nEmployees
}
Copy link to clipboard
Copied
That works great! Thanks for the information.
This may be ao ongoing requirement for my business. Do you have a suggestion as to how I can either
a) learn how to do this
b) contract someone to do this.
Thanks again!!!
Copy link to clipboard
Copied
Here is a site all about Acrobat Scripting (there's plenty of free material to look over):
https://www.pdfscripting.com/public/main.cfm
For contract work, contact me: