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

Simple form requiring simple Javascript, tearing hair out

Explorer ,
Feb 03, 2025 Feb 03, 2025

Copy link to clipboard

Copied

I have a form with radio buttons and a total.

 

When you select certain buttons the price is totalled in a 'Total' field box..

 

There is one radio button 'Withdrawal' that if clicked, the total price in the 'total' field needs to increase by 6.9% 

I've tried adding code to 'Total' the extra 6.9% if the radio button 'Withdrawal' is selected. No Luck

I've tried adding code to ''Withdrawal' radion button to incrase the 'Total' by 6.9% if selected. No Luck

 

PDF ATTACHED!

TOPICS
PDF forms

Views

67

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
1 ACCEPTED SOLUTION
Community Expert ,
Feb 03, 2025 Feb 03, 2025

Copy link to clipboard

Copied

Use this as custom calculation script in "Total" field, it will calculate all checkboxes and add 6.9% increase if withdrawal is checked:

var fields = [
  "MarketingPackageA",
  "MarketingPackageB",
  "MarketingPackageC",
  "Audience Maximiser",
  "Photo For Sale Sign",
  "Sunset Photoshoot",
  "Be Seen Social Media",
  "Auctioneer’s Fee",
  "Body Corporate Disclosure Statement",
  "Title Search"
];

var per = 1.069;
var total = 0;

for(var i=0; i<fields.length; i++){
 var f = this.getField(fields[i]).valueAsString;
 if(f !== "Off")
  total += Number(f);}

if(this.getField("Withdrawal").valueAsString !== "Off")
total = total*per;

event.value = total.toFixed(2);

View solution in original post

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
Community Expert ,
Feb 03, 2025 Feb 03, 2025

Copy link to clipboard

Copied

Use this as custom calculation script in "Total" field, it will calculate all checkboxes and add 6.9% increase if withdrawal is checked:

var fields = [
  "MarketingPackageA",
  "MarketingPackageB",
  "MarketingPackageC",
  "Audience Maximiser",
  "Photo For Sale Sign",
  "Sunset Photoshoot",
  "Be Seen Social Media",
  "Auctioneer’s Fee",
  "Body Corporate Disclosure Statement",
  "Title Search"
];

var per = 1.069;
var total = 0;

for(var i=0; i<fields.length; i++){
 var f = this.getField(fields[i]).valueAsString;
 if(f !== "Off")
  total += Number(f);}

if(this.getField("Withdrawal").valueAsString !== "Off")
total = total*per;

event.value = total.toFixed(2);

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
Explorer ,
Feb 03, 2025 Feb 03, 2025

Copy link to clipboard

Copied

LATEST

OMG It worked! You are amazing! Thank you so much.

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