Skip to main content
Participating Frequently
April 11, 2018
Answered

Custom Calculation on a form

  • April 11, 2018
  • 1 reply
  • 638 views

I am trying to write a custom calculation that adds 3 percent to a specified total when over 500 dollars if a credit card number appears in a field at the bottom of the form

This topic has been closed for replies.
Correct answer try67

here is the scenario

total before freight

freight

total with freight

grand total

The grand total should be the total with a 3% up charge if the credit card field at the bottom of the form is complete

if not complete then should display same as total w freight


OK. Let's say the name of the CC field is "CC". In that case, use this code as the custom calculation script of "Grand total".

var total = Number(this.getField("total with freight").valueAsString);

if (this.getField("CC").valueAsString=="") event.value = total;

else event.value = total * 1.03;

1 reply

try67
Community Expert
Community Expert
April 13, 2018

Is this a PDF form, created in Acrobat?

Participating Frequently
April 13, 2018

yes, this is a pdf form created in Acrobat

try67
Community Expert
Community Expert
April 13, 2018

OK, I'm going to move your question to a more relevant forum: JavaScript

Can you describe the exact conditions in which you want this calculation to take place?

Is it when the value of one field is more than 500, AND a different field (the CC number) is not empty?