Skip to main content
Participant
February 27, 2025
Answered

Need help calculating total amount based on number of chosen checkboxes and entered amount

  • February 27, 2025
  • 1 reply
  • 541 views

Hi,

 

I have no clue how to do this, but I need help to calculate a total amount based on the number of checkboxes with an amount field that the client would input. See picture. Any help would be greatly appreciated.

 

For example, if client wanted to order time for a radio station for a certain amount that they would input, then it would show up in the total on the right. If they wanted to order time for more than one station, i need the amount to be multiplied by the number of checkboxes they choose. If that makes any sense.

Correct answer PDF Automation Station

Create the first text box and call it Subtotal.  In form editing mode, right-click the box, select Create muliple copies and enter 5 down and 1 across.  In the Total field, calculation tab, select Value is the Sum, then select the Subtotal field.

1 reply

PDF Automation Station
Community Expert
Community Expert
February 27, 2025

Make sure the check boxes have the same name, but with a different number at the end (example: Station1, Station2, Station3, Station4, Station5).  Assuming the amount field is named "Amount", enter the following custom calculation script in the total field:

var cnt =0;
for(var i=1; i<6; i++)
{
if(this.getField("Station"+i).value!="Off")
{cnt++}
}
event.value=this.getField("Amount").value*cnt;
kimmyd71Author
Participant
February 28, 2025

Thank you so much! It worked! I appreciate it!