Renamed textfields and changed the javascript codes accordingly, now formulas doesn't work anymore.

Community Beginner ,
Apr 23, 2019 Apr 23, 2019

Copy link to clipboard

Copied

I was tasked to rename some textfields, checkboxes, radio buttons and dropdown fields in a working Fillable form. The only thing I did was to add prefixes to the original name and update the javascript codes of fields (replace old field names with new ones).

I got a feedback saying that only a few of the calculations work and majority isn't working anymore.

I didn't create this form and haven't used it even once. How do I identify what went wrong and what fields to look at?

Thank you in advance.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

490

Likes

translate

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 24, 2019 Apr 24, 2019
Go to Tools - JavaScript - Edit All JavaScripts and search for the old field names that you see in the error messages. That will let you know where there are located, but DO NOT edit them there. Close that window and edit the code directly from the fields themselves. In the future it will be easier if you placed all the code inside functions in a doc-level script, as then you would be able to search and edit it at the same time.

Likes

translate

Translate

Translate
Most Valuable Participant ,
Apr 23, 2019 Apr 23, 2019

Copy link to clipboard

Copied

First step is to get more information. "It doesn't work" can mean many different things. Ask for exact details.

Also, ask in what application they are viewing the file and exactly what they did when it "didn't work", including screenshots, if possible.

Likes

translate

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 24, 2019 Apr 24, 2019

Copy link to clipboard

Copied

They are using an iPad, PDF Expert app.

So I tried the Ctrl+J and these errors appeared,

Acrobat EScript Built-in Functions Version 11.0

Acrobat SOAP 11.0

TypeError: getField("txt_DB_CFA") is null

1:Field:Calculate

TypeError: getField("txt_DB_CFA") is null

1:Field:Calculate

TypeError: getField("txt_DB_CFA") is null

1:Field:Calculate

TypeError: getField("c_DB_PerSystem1") is null

2:Field:Calculate

TypeError: getField("c_DB_PerSystem2") is null

2:Field:Calculate

TypeError: getField("c_DB_PerSystem3") is null

2:Field:Calculate

TypeError: getField("c_DB_PerSystem1") is null

2:Field:Calculate

TypeError: getField("c_DB_PerSystem2") is null

2:Field:Calculate

TypeError: getField("c_DB_PerSystem3") is null

2:Field:Calculate

TypeError: this.getField("c_DB_PerSystem1") is null

2:Field:Calculate

TypeError: this.getField("c_DB_PerSystem2") is null

2:Field:Calculate

TypeError: this.getField("c_DB_PerSystem3") is null

2:Field:Calculate

InvalidSetError: Set not possible, invalid or unknown.

Field.value:8:Field c_ACH50:Calculate

I already renamed the txt_DB_CFA field to c_DB_CFA so I am not sure why that is still appearing in the error.

Any idea on how to fix these errors?

Likes

translate

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 24, 2019 Apr 24, 2019

Copy link to clipboard

Copied

When you change the name of a field you must also change the Javascript code.

Likes

translate

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 24, 2019 Apr 24, 2019

Copy link to clipboard

Copied

Yes, I changed the Javascript codes as well. I may have missed some since there are plenty of fields. Is there a way to know the specific fields that causes the error or I have to do it manually?

Likes

translate

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 24, 2019 Apr 24, 2019

Copy link to clipboard

Copied

Go to Tools - JavaScript - Edit All JavaScripts and search for the old field names that you see in the error messages. That will let you know where there are located, but DO NOT edit them there. Close that window and edit the code directly from the fields themselves. In the future it will be easier if you placed all the code inside functions in a doc-level script, as then you would be able to search and edit it at the same time.

Likes

translate

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 24, 2019 Apr 24, 2019

Copy link to clipboard

Copied

Thanks. I see all the codes now. This is my first time identifying specific fields, how do I do that? Do I look at the Ln # and Col #?

Likes

translate

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 24, 2019 Apr 24, 2019

Copy link to clipboard

Copied

Look at "belongs to:".

Likes

translate

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

Thank you.

Likes

translate

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 24, 2019 Apr 24, 2019

Copy link to clipboard

Copied

Search for the specific field names listed in the error report.  It helps to edit the code in a different plain text editor. 

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

Likes

translate

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

I did this too. Thanks

Likes

translate

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

Thank you again for your help.

Likes

translate

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