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

Javascript not calculating in Field in PDF

New Here ,
Jan 03, 2023 Jan 03, 2023

Copy link to clipboard

Copied

Nothing is getting calculated. This is my Javascript

 

// Get the values of DiscountPrice1 through DiscountPrice10
var discountPrices = [DiscountPrice1, DiscountPrice2, DiscountPrice3, DiscountPrice4, DiscountPrice5, DiscountPrice6, DiscountPrice7, DiscountPrice8, DiscountPrice9, DiscountPrice10];

// Add up the values of DiscountPrice1 through DiscountPrice10
var shippingTotal = discountPrices.reduce((accumulator, currentValue) => accumulator + currentValue, 0);

// Check if the shipping total is less than $60
if (shippingTotal < 60) {
// If the shipping total is less than $60, set the shipping total to $7.50
Shipping.value = 7.5;
} else {
// If the shipping total is more than $60, calculate 12% of Price1 through Price10
var prices = [Price1, Price2, Price3, Price4, Price5, Price6, Price7, Price8, Price9, Price10];
var priceTotal = prices.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
Shipping.value = priceTotal * 0.12;
}

TOPICS
JavaScript , PDF forms

Views

2.3K

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 ,
Jan 03, 2023 Jan 03, 2023

Copy link to clipboard

Copied

Check the JavaScript console for errors.

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
New Here ,
Jan 03, 2023 Jan 03, 2023

Copy link to clipboard

Copied

There are no errors showing up in Adobe. I'm not familiar with Javascript in particular but am familiar with coding in general. Is there a way recommended way to check? 

 

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 ,
Jan 04, 2023 Jan 04, 2023

Copy link to clipboard

Copied

Open the console with ctrl-j or cmd-j.

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 ,
Jan 03, 2023 Jan 03, 2023

Copy link to clipboard

Copied

I don't see where any field values are acquired, or where the calculation result is set. 

Please read these articles:

https://www.pdfscripting.com/public/PDF-Form-Scripting.cfm

Scroll down to the "How to Script a PDF Form". It's the 3rd topic.

 

https://www.pdfscripting.com/public/How-to-Write-a-Basic-PDF-Calculation-Script.cfm

 

 

 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
New Here ,
Jan 04, 2023 Jan 04, 2023

Copy link to clipboard

Copied

Thanks. I've added that but it still is not working: 

 

// Get the discounted item total
var discountedItemTotal =
this.getField("DiscountedPrice1").value +
this.getField("DiscountedPrice2").value +
this.getField("DiscountedPrice3").value +
this.getField("DiscountedPrice4").value +
this.getField("DiscountedPrice5").value +
this.getField("DiscountedPrice6").value +
this.getField("DiscountedPrice7").value +
this.getField("DiscountedPrice8").value +
this.getField("DiscountedPrice9").value +
this.getField("DiscountedPrice10").value;

// Get the retail price of the items
var retailPrice =
this.getField("Price1").value +
this.getField("Price2").value +
this.getField("Price3").value +
this.getField("Price4").value +
this.getField("Price5").value +
this.getField("Price6").value +
this.getField("Price7").value +
this.getField("Price8").value +
this.getField("Price9").value +
this.getField("Price10").value;

var shipping;

// If the discounted item total is less than $60, apply a $7.50 fee for shipping
if (discountedItemTotal < 60) {
shipping = 7.50;
} else {
// If the item total is more than $60, the shipping cost should show 12% of the retail price of the items
shipping = retailPrice * 0.12;
}

console.log(shipping);

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 ,
Jan 04, 2023 Jan 04, 2023

Copy link to clipboard

Copied

Replace
console.log(shipping);
with
console.show();
console.println(shipping);

 

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 ,
Jan 04, 2023 Jan 04, 2023

Copy link to clipboard

Copied

Saying "it's not working" is not very helpful to us. Are there error messages in the JS Console?

Does the script produce any output at all? If so, what output, and what why is it wrong?

If you don't provide details we can't help you solve your issues.

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
New Here ,
Jan 04, 2023 Jan 04, 2023

Copy link to clipboard

Copied

Sorry. I mean that nothing is happening. No calculcation is showing up. The field remains blank.

 

 

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
New Here ,
Jan 04, 2023 Jan 04, 2023

Copy link to clipboard

Copied

Changing that code did not work. No numbers are showing in the shipping field.

 

Screen Shot 2023-01-04 at 10.01.37 AM.png

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
New Here ,
Jan 04, 2023 Jan 04, 2023

Copy link to clipboard

Copied

Screen Shot 2023-01-04 at 10.03.52 AM.png

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 ,
Jan 04, 2023 Jan 04, 2023

Copy link to clipboard

Copied

Nowhere in your code are you applying the value to the field.

Add this to the end of it:

event.value = shipping;

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
New Here ,
Jan 04, 2023 Jan 04, 2023

Copy link to clipboard

Copied

There is still nothing showing up when I added event.value=shipping; at the end 

 

Here is the code:

// Get the discounted item total
var discountedItemTotal =
this.getField("DiscountedPrice1").value +
this.getField("DiscountedPrice2").value +
this.getField("DiscountedPrice3").value +
this.getField("DiscountedPrice4").value +
this.getField("DiscountedPrice5").value +
this.getField("DiscountedPrice6").value +
this.getField("DiscountedPrice7").value +
this.getField("DiscountedPrice8").value +
this.getField("DiscountedPrice9").value +
this.getField("DiscountedPrice10").value;

// Get the retail price of the items
var retailPrice =
this.getField("Price1").value +
this.getField("Price2").value +
this.getField("Price3").value +
this.getField("Price4").value +
this.getField("Price5").value +
this.getField("Price6").value +
this.getField("Price7").value +
this.getField("Price8").value +
this.getField("Price9").value +
this.getField("Price10").value;

var shipping;

// If the discounted item total is less than $60, apply a $7.50 fee for shipping
if (discountedItemTotal < 60) {
shipping = 7.50;
} else {
// If the item total is more than $60, the shipping cost should show 12% of the retail price of the items
shipping = retailPrice * 0.12;
}

console.show();
console.println(shipping);
event.value = shipping;Screen Shot 2023-01-04 at 10.28.39 AM.png

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 ,
Jan 04, 2023 Jan 04, 2023

Copy link to clipboard

Copied

You still haven't answered our questions about error messages in the Console. Unless you do that, and/or share the file with us, we can't help you any further with this.

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
New Here ,
Jan 04, 2023 Jan 04, 2023

Copy link to clipboard

Copied


TypeError: getField(...) is null
1:Field:Calculate
TypeError: getField(...) is null
1:Field:Calculate
ReferenceError: QtyRow3 is not defined
1:Console:Exec
undefined
ReferenceError: QtyRow6 is not defined
1:Console:Exec
undefined
ReferenceError: DiscountPriceRow4 is not defined
1:Console:Exec
undefined
ReferenceError: DiscountPriceRow5 is not defined
1:Console:Exec
undefined
SyntaxError: syntax error
1:Field:Calculate
SyntaxError: syntax error
1:Field:Calculate
SyntaxError: syntax error
1:Field:Calculate
SyntaxError: syntax error
1:Field:Calculate
ReferenceError: QtyRow5 is not defined
1:Console:Exec
undefined
ReferenceError: QtyRow7 is not defined
1:Console:Exec
undefined
ReferenceError: QtyRow1 is not defined
1:Field:Calculate
ReferenceError: QtyRow1 is not defined
1:Field:Calculate
ReferenceError: QtyRow1 is not defined
1:Field:Calculate
ReferenceError: QtyRow1 is not defined
1:Field:Calculate
ReferenceError: QtyRow1 is not defined
1:Field:Calculate
ReferenceError: QtyRow1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: Sum is not defined
1:Field:Calculate
ReferenceError: Sum is not defined
1:Field:Calculate
ReferenceError: Sum is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: SUM is not defined
1:Field:Calculate
ReferenceError: SUM is not defined
1:Field:Calculate
ReferenceError: SUM is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
TypeError: getField(...) is null
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
ReferenceError: sum is not defined
1:Field:Calculate
SyntaxError: missing } in compound statement
4:
ReferenceError: sum is not defined
1:Field:Calculate
SyntaxError: missing ; before statement
1:
SyntaxError: missing ; before statement
1:
SyntaxError: missing ; before statement
1:
SyntaxError: missing ; before statement
1:
SyntaxError: missing ; before statement
1:
SyntaxError: missing ; before statement
1:
SyntaxError: missing ; before statement
1:
SyntaxError: missing ; before statement
1:
SyntaxError: missing ; before statement
1:
SyntaxError: missing ; before statement
1:
SyntaxError: missing ; before statement
1:
SyntaxError: missing ; before statement
1:
SyntaxError: missing ; before statement
1:
SyntaxError: missing ; before statement
1:
SyntaxError: missing ; before statement
1:
SyntaxError: missing ; before statement
1:
SyntaxError: missing ; before statement
1:
SyntaxError: missing ; before statement
1:
SyntaxError: missing ; before statement
1:
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
SyntaxError: missing ; before statement
1:
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
1:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
2:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
2:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
2:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
2:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
2:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
2:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
2:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
2:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
2:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
2:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
2:Field:Calculate
ReferenceError: DiscountPrice1 is not defined
2:Field:Calculate
SyntaxError: missing ; before statement
26:
SyntaxError: missing ; before statement
27:
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
1:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate
TypeError: this.getField(...) is null
3:Field:Calculate

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
LEGEND ,
Jan 04, 2023 Jan 04, 2023

Copy link to clipboard

Copied

And what about the console? Your code asked for it to appear. Did it appear? What did it contain?

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
New Here ,
Jan 04, 2023 Jan 04, 2023

Copy link to clipboard

Copied

Here is what shows in the console

 

TypeError: getField(...) is null 1:Field:Calculate TypeError: getField(...) is null 1:Field:Calculate ReferenceError: QtyRow3 is not defined 1:Console:Exec undefined ReferenceError: QtyRow6 is not defined 1:Console:Exec undefined ReferenceError: DiscountPriceRow4 is not defined 1:Console:Exec undefined ReferenceError: DiscountPriceRow5 is not defined 1:Console:Exec undefined SyntaxError: syntax error 1:Field:Calculate SyntaxError: syntax error 1:Field:Calculate SyntaxError: syntax error 1:Field:Calculate SyntaxError: syntax error 1:Field:Calculate ReferenceError: QtyRow5 is not defined 1:Console:Exec undefined ReferenceError: QtyRow7 is not defined 1:Console:Exec undefined ReferenceError: QtyRow1 is not defined 1:Field:Calculate ReferenceError: QtyRow1 is not defined 1:Field:Calculate ReferenceError: QtyRow1 is not defined 1:Field:Calculate ReferenceError: QtyRow1 is not defined 1:Field:Calculate ReferenceError: QtyRow1 is not defined 1:Field:Calculate ReferenceError: QtyRow1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: Sum is not defined 1:Field:Calculate ReferenceError: Sum is not defined 1:Field:Calculate ReferenceError: Sum is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: SUM is not defined 1:Field:Calculate ReferenceError: SUM is not defined 1:Field:Calculate ReferenceError: SUM is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate TypeError: getField(...) is null 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate ReferenceError: sum is not defined 1:Field:Calculate SyntaxError: missing } in compound statement 4: ReferenceError: sum is not defined 1:Field:Calculate SyntaxError: missing ; before statement 1: SyntaxError: missing ; before statement 1: SyntaxError: missing ; before statement 1: SyntaxError: missing ; before statement 1: SyntaxError: missing ; before statement 1: SyntaxError: missing ; before statement 1: SyntaxError: missing ; before statement 1: SyntaxError: missing ; before statement 1: SyntaxError: missing ; before statement 1: SyntaxError: missing ; before statement 1: SyntaxError: missing ; before statement 1: SyntaxError: missing ; before statement 1: SyntaxError: missing ; before statement 1: SyntaxError: missing ; before statement 1: SyntaxError: missing ; before statement 1: SyntaxError: missing ; before statement 1: SyntaxError: missing ; before statement 1: SyntaxError: missing ; before statement 1: SyntaxError: missing ; before statement 1: ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate SyntaxError: missing ; before statement 1: ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 1:Field:Calculate ReferenceError: DiscountPrice1 is not defined 2:Field:Calculate ReferenceError: DiscountPrice1 is not defined 2:Field:Calculate ReferenceError: DiscountPrice1 is not defined 2:Field:Calculate ReferenceError: DiscountPrice1 is not defined 2:Field:Calculate ReferenceError: DiscountPrice1 is not defined 2:Field:Calculate ReferenceError: DiscountPrice1 is not defined 2:Field:Calculate ReferenceError: DiscountPrice1 is not defined 2:Field:Calculate ReferenceError: DiscountPrice1 is not defined 2:Field:Calculate ReferenceError: DiscountPrice1 is not defined 2:Field:Calculate ReferenceError: DiscountPrice1 is not defined 2:Field:Calculate ReferenceError: DiscountPrice1 is not defined 2:Field:Calculate ReferenceError: DiscountPrice1 is not defined 2:Field:Calculate SyntaxError: missing ; before statement 26: SyntaxError: missing ; before statement 27: TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 1:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate TypeError: this.getField(...) is null 3:Field:Calculate

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
New Here ,
Jan 04, 2023 Jan 04, 2023

Copy link to clipboard

Copied

For some reason the error messages from the console are not posting on the community page when I hit reply here. Maybe you are seeing it, but I am not.

 

I'm going to hire a freelancer from Fiverr to write the script. This kind of coding is beyond my capabilities. Thank you for your time. 

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
LEGEND ,
Jan 04, 2023 Jan 04, 2023

Copy link to clipboard

Copied

No, we're not seeing it either. This must be very frustrating for you too; without the console info we can only make wild guesses. You can try a copy/paste of the full text. Tip: you cannot send any pictures if you reply by email. 

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 ,
Jan 04, 2023 Jan 04, 2023

Copy link to clipboard

Copied

LATEST
quote

I'm going to hire a freelancer from Fiverr to write the script. This kind of coding is beyond my capabilities. Thank you for your time. 


By efagan@eatright.org

 

You might consider hiring one of the expert posters here. I don't think you'll find a better pool of experts in Acrobat scripting. And after all, you've already gotten free help from several. 

 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 ,
Jan 03, 2023 Jan 03, 2023

Copy link to clipboard

Copied

Your code is either incomplete, or you didn't include all of it. It's missing the definitions of many variables, such as Shipping, DiscountPrice1-DiscountPrice10, Price1-Price10, etc.

If those are field names, you can't access them like that. You have to use the getField to do it, and then the value property to access those fields' values.

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
LEGEND ,
Jan 04, 2023 Jan 04, 2023

Copy link to clipboard

Copied

No sure whether you are expecting errors to pop up in Acrobat. They won't. You must use the console. Check it even in forms that seem to work. 

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 ,
Jan 04, 2023 Jan 04, 2023

Copy link to clipboard

Copied

Where does you use the script?

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