Skip to main content
adc501
Participant
Jan 24, 2018 4:33 PM UTC
Question

Need JavaScript to Calculate Number of Checkboxes Minus 1

I have a fillable PDF form with five checkboxes named FEES3, FEES4, FEES5, FEES6, and FEES7. When any one of these five checkboxes is selected, a text field named Subtotal4 is automatically populated with a fee of $115. Each checkbox has the following JavaScript:

if (event.target.value=="Off") this.getField("Subtotal4").value = 0;

else this.getField("Subtotal4").value = 115;

After one checkbox is selected, every other checkbox should be $55, not $115. I have a second text field named Totalotherfees that I would like to populate with the number of additional checkboxes that were selected. So if one checkbox is selected, the Totalotherfees text field would remain empty. If 2 or more checkboxes are selected, the Totalotherfees text field would populate with the number of additional checkboxes selected.

Is there a script that I can add to the Totalotherfees text field to count the additional number of checkboxes selected? Or a script that will add the total number of checkboxes selected and subtract 1?

This topic is closed to new replies. Start a new post to keep the conversation going.

1 reply

Inspiring
Jan 24, 2018 8:42 PM UTC

This will require a Custom JavaScript action and the name of each field to be accessed needs to be provided.

Translate