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

Field won't calculate properly

New Here ,
Nov 27, 2017 Nov 27, 2017

I'm working on a fairly complex form that calculates lots of different fields and this ONE FIELD is being super weird.

It's one of the last fields for validation to make sure the user has input the right amounts.

So the relevant fields are:

DC Amount - freeform

Div Funding -  Calculated as 12% of DC Amount

AW Fee - This has a custom calculation so it varies depending on DC Amount, but usually it's 1% of DC Amount.

var Total = this.getField("DC Amount").value;

var sponsor = this.getField("sponsor").value;

if (sponsor=="A") {

    event.value = 0;

}

    else if (sponsor == B" ) {

        if (Total <= 10000) {

    event.value = 0;

} else if (Total >= 1500000) {

    event.value = 15000

} else {

     event.value = Total * .01;

}

}

So, if I put DC Amount as 50,000, AW Fee is 500.

Other Funding - Freeform

Funding Validation - This is the troublesome field. Basically it's calculated like this:

Div Funding - (Other Funding + AW Fee)

And the total should end up as 0.

Simple, right?

So if my DC Amount is 50,000, the Div Funding is calculated as 6000, and the AW Fee is 500.

At that point, my Funding Validation shows 5500, which is correct.

So in theory I should be able to put 5500 into Other Funding, which will make the formula 6000 - (5500 + 500) and the field will show 0.

But it does not. Instead, it shows... -5,494,500

However, if I put in any amount under 10, it just subtracts normally.

I think it's something with the AW Fee field calculation that's messing it up but I can't figure it out at all.

TOPICS
Acrobat SDK and JavaScript , Windows
550
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

correct answers 1 Correct answer

LEGEND , Nov 28, 2017 Nov 28, 2017

This line:

else if (sponsor == B" ) {

Should be:

else if (sponsor == "B" ) {

Translate
LEGEND ,
Nov 27, 2017 Nov 27, 2017

Check the Acrobat JavaScript for errors.

Check the field calculation order.

If problem not found post a public link to a sample of the form with the problem.

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 ,
Nov 28, 2017 Nov 28, 2017

The calculation order (for the fields that need to calculate) goes:

  1. Div Funding Amount
  2. AW Fee
  3. Funding Validation

Which should be working just fine, right?

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
LEGEND ,
Nov 28, 2017 Nov 28, 2017
LATEST

This line:

else if (sponsor == B" ) {

Should be:

else if (sponsor == "B" ) {

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