Creating a calculation field to add up interactive buttons

New Here ,
Feb 21, 2020

Copy link to clipboard

Copied

I've created a interactive pdf where the buttons reveal a number(which is a button itself)  os there a way to create a calculation field in acrobat so that what ever number appears is calculated as a total score. 

70F148D9-34B3-49FE-916F-F077515DB8EB.png

 

TOPICS
Acrobat SDK and JavaScript, PDF forms

Views

40

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
Feb 21, 2020

Copy link to clipboard

Copied

Buttons don't have values. However, you can write a script that will check the visibility property of the button fields and if they are visible it will assume they have a value and use it to calculate a sum.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Feb 21, 2020

Copy link to clipboard

Copied

Yes and No, as Try states, buttons don't have a value.

Do you have to use buttons?

If so then the values for the calculation could be stored in a JS object that matches the button name to a value. 

The best way to do this is to use group naming with the buttons,i.e., "Score.Button1" "Score.Button2" etc. then a generic script can be written to loop through the buttons, adding up the values for the ones that are visible. 

 

If the buttons can be replace with somthing that does have a value, like a field, then the same technique applies, only you don't need the JS object for mapping values. 

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more