Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Feb 27, 2025 Feb 27, 2025

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.

TOPICS
JavaScript , PDF forms
227
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Feb 28, 2025 Feb 28, 2025

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.

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 27, 2025 Feb 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;
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 28, 2025 Feb 28, 2025

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 28, 2025 Feb 28, 2025

Ok. Client just threw a monkey wrench into the whole thing. Now they want amount boxes by each station to input amounts and then calculate into the total box. See attached.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 28, 2025 Feb 28, 2025

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 28, 2025 Feb 28, 2025

Thanks! That worked, but I have a gut feeling the client will change something else and make it more complicated.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 28, 2025 Feb 28, 2025
LATEST

No changes! Thanks so much!

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