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

Calculating totals for fields with and without radio buttons

New Here ,
Mar 26, 2024 Mar 26, 2024

Copy link to clipboard

Copied

I have created a payment authorization form but am having trouble calculating totals. I attached a copy of the document for reference. Basically I have a box to enter amount then radio buttons to indicate service fees. One is ach and one is credit card fee. Lastly I have a total box. For the ach radio button I would like it to fill in $4 when selected. For the credit card fee I would like it to calculate 3.5% of what is in the amount box. Then I would like the total to add the amount. And which ever value fills in from the radio buttons. How do I accomplish this??

TOPICS
How to

Views

68

Translate

Translate

Report

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 ,
Mar 26, 2024 Mar 26, 2024

Copy link to clipboard

Copied

LATEST

As 'Custom calculation script' of "Total" field use this:

var rb = this.getField("Group1").valueAsString;
var amt = Number(this.getField("Amount2").valueAsString);
var ach = this.getField("ACH Fee");
var cc = this.getField("Credit Card Fee");
var achT = rb === "ACH" ? 4 : 0;
var ccT = rb === "Credit Card" ? (.035*amt) : 0;

ach.value = achT;
cc.value = ccT;
event.value = amt+achT+ccT;

Votes

Translate

Translate

Report

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