I have multiple forms that all follow a similar format, and that are exported from an InDesign table into Acrobat DC and then prepared as fillable forms. These track a student’s progress with a series of tasks (lines of text from the original InDesign file) and a rating of either 1, 2, or 3 (prepared as radio buttons with 3 choices) for each task. I need to create a field to calculate the percentage of radio buttons that have been chosen (i.e., if there are 10 lines [hence 10 radio-button sets] and 4 have an entry choice selected, the field I want to create would return “40”--4 out of 10 radio-button-sets have a selection made=40%). I would LIKE to be able to calculate this percentage based on only those button choices that are a “2” or a “3” (passing grades), but I could eliminate the “1” choice and turn that into a check box, meaning that the script would only need to act on “any choice selected” instead of 2 out of the 3 choices.
Acrobat DC allows for a text box to be designated as a calculated field using JavaScript, but I have never even tried to use JS before. Can anyone help me with a script that will divide the number of radio buttons that have a choice selected (n) by the total number of radio buttons (t), and then return that percentage (%) [n/t=%]? Since the line on which this field will be placed already has a percentage sign already in place (in the original InDesign text), it would be ideal for this percentage to be returned as a whole number (in the above example, “40” not “40%” or “.4” but I can remove that sign if I must.