Which field is my javascript error in?

Community Beginner ,
Apr 24, 2019 Apr 24, 2019

Copy link to clipboard

Copied

TypeError: f is null

1051:byteCodeTool

That's the error I'm getting. The main problem is I have 88 fields being calculated. Is there a way to more easily find the source of this than to dig through each field?

TOPICS
Acrobat SDK and JavaScript, Windows

Views

238

Likes

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

correct answers 1 Correct Answer

Most Valuable Participant , Apr 26, 2019 Apr 26, 2019
Go to Edit - Preferences - JavaScript and select an external editor, like Notepad.exe ...

Likes

Translate

Translate
Adobe Community Professional ,
Apr 25, 2019 Apr 25, 2019

Copy link to clipboard

Copied

HI,

With the form open, search the tools for "All JavaScripts", this will open every JavaScript in the document in one file, DO NOT CHANGE this as it is very easy to break the document. Once you have located what you think is the problem you should go to the form field and make the change there.

Regards

Malcolm

Likes

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 Beginner ,
Apr 25, 2019 Apr 25, 2019

Copy link to clipboard

Copied

Sadly, that gives me a popup.

Text cannot be display in full by the Edit Dialog.

Please use an External Editor.

Not an overly helpful popup.

Oh, and javascript, lots of javascript. Large arrays and for loops, mostly.

Likes

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
Adobe Community Professional ,
Apr 25, 2019 Apr 25, 2019

Copy link to clipboard

Copied

Did you create this form and the scripts?

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

Likes

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 Beginner ,
Apr 26, 2019 Apr 26, 2019

Copy link to clipboard

Copied

I created the fields and javascript from a base pdf version of a form which was originally intended to be printed and filled in by hand.

Likes

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
Most Valuable Participant ,
Apr 26, 2019 Apr 26, 2019

Copy link to clipboard

Copied

Go to Edit - Preferences - JavaScript and select an external editor, like Notepad.exe ...

Likes

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 Beginner ,
Apr 26, 2019 Apr 26, 2019

Copy link to clipboard

Copied

LATEST

Very helpful. Thank you. ^_^ The specific error sadly isn't in my code so much as a field format issue, from the searches on the specific one, but this helped me find another that cropped up as I was tweaking.

Likes

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
Adobe Community Professional ,
Apr 25, 2019 Apr 25, 2019

Copy link to clipboard

Copied

So "f" must be script variable that is set from "getField"? And you use it in the custom calculation script in all 88 fields? 

Or, are you using simplified field notation for the calculation? I ask this because the error is reported on line 1051 of a script called the "byteCodeTool".  This implies there is an error in translating code.  This is important for understanding the context of the error.

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

Likes

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
Adobe Community Professional ,
Apr 26, 2019 Apr 26, 2019

Copy link to clipboard

Copied

I always keep Acrobat 9 Pro on my Mac for 2 reasons:

- The JavaScript Console of Acrobat 9 and older versions gives the field name source of error.

- It's faster and more efficient (no crash) for batch process.

I guess that Adobe Reader 9 should be enought to display errors in the JavaScript Console (don't forget to enable the debugger in JavaScript Preferences).

Likes

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