Adobe Acrobat Javascript help

Hello, I only know the basics of Java coding so I am not very good.

I have a document I am working with that has cuustom form fields.

I need help writing a script that says. If “choice1” is checked then it will discount 5% from the “Grand Total” field. And if “choice2” is checked then the “Grand Total” field will stay the same.

I am using radial buttons.

the “Grand Total” field is calculating the sum of multiple fields also.

so essentially if a customer wants to click yes to pickup they get a 5% discount from their total.

Java or JavaScript. Those are two different languages - don’t let the name fool you.

I have a document I am working with that has cuustom form fields.

What kind of document? You mention Adobe - do you mean a pdf file?

Do you have a sample file you are trying to read? Do you have the code you’ve tried?

It’s a JavaScript code
On a custom form field in a PDF document

They have specific APIs. I would suggest you read the “Acrobat JavaScript Developer Guide” (Chapter 6 Using JavaScript in Forms) from the Acrobat SDK 2021 page.

The Developer Guide pdf has some examples like “Calculating the average of several text fields”. In the loop example, you would likely need to check the isBoxChecked property of the checkboxes to skip or include the specific inputs.

I don’t have Acrobat installed so I can’t really test anything but it looks a lot like the browser web APIs.

Thanks I will look into this

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.