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

cannot figure out why error

Contributor ,
Jul 17, 2023 Jul 17, 2023

Copy link to clipboard

Copied

I keep getting these errors. I've gone back and copied/pasted field names exactly, but can't correct. Any guidance greatly appreciated!
TypeError: this.getField(...) is null
11:Field:Mouse Up
TypeError: this.getField(...) is null
31:AcroForm:CkBxOR82040:Annot1:MouseUp:Action1
TypeError: this.getField(...) is null
11:AcroForm:CkBxOR82040:Annot1:MouseUp:Action1
TypeError: this.getField(...) is null
26:Field:Mouse Up

TypeError: this.getField(...) is null
55:AcroForm:CkBxOR82040:Annot1:MouseUp:Action1

 

Here's the checkbox field 'mouse-op javascript' I'm using.

 

if (event.target.value == "or") {

// box is checked
this.getField("RBCoOwnerResident82040").display = display.visible;
this.getField("RBCoOwnerCitizen82040").display = display.visible;
this.getField("RBCoOwnerHear82040").display = display.visible;
this.getField("RBCoOwnerType82040").display = display.visible;
this.getField("CoOwnerName82040").display = display.visible;
this.getField("CoOwnerPhone82040").display = display.visible;
this.getField("CoOwnerEmail82040").display = display.visible;
this.getField("CoOwnerSex82040").display = display.visible;
this.getField("CoOwnerDOB82040").display = display.visible;
this.getField("CoOwnerID82040").display = display.visible;
this.getField("CkBxSameMailAddress82040").display = display.visible;
this.getField("CoOwnerMailAddress82040").display = display.visible;
this.getField("CoOwnerMailCity82040").display = display.visible;
this.getField("CoOwnerMailState82040").display = display.visible;
this.getField("CoOwnerMailZipCode82040").display = display.visible;
this.getField("CkBxSameCoOwnerMailAddress82040").display = display.visible;
this.getField("CoOwnerPhysicalAddress82040").display = display.visible;
this.getField("CoOwnerPhysicalCity82040").display = display.visible;
this.getField("CoOwnerPhysicalState82040").display = display.visible;
this.getField("CoOwnerPhysicalZipCode82040").display = display.visible;
this.getField("CoOwnerSignature82040").display = display.visible;
this.getField("CoOwnerSignDate82040").display = display.visible;
this.getField("CoOwnerSignature84490").display = display.visible;
this.getField("CoOwnerSignature84491").display = display.visible;
}
else {

// box is unchecked

this.getField("RBCoOwnerResident82040").display = display.hidden;
this.getField("RBCoOwnerCitizen82040").display = display.hidden;
this.getField("RBCoOwnerHear82040").display = display.hidden;
this.getField("RBCoOwnerType82040").display = display.hidden;
this.getField("CoOwnerName82040").display = display.hidden;
this.getField("CoOwnerPhone82040").display = display.hidden;
this.getField("CoOwnerEmail82040").display = display.hidden;
this.getField("CoOwnerSex82040").display = display.hidden;
this.getField("CoOwnerDOB82040").display = display.hidden;
this.getField("CoOwnerID82040").display = display.hidden;
this.getField("CkBxSameMailAddress82040").display = display.hidden;
this.getField("CoOwnerMailAddress82040").display = display.hidden;
this.getField("CoOwnerMailCity82040").display = display.hidden;
this.getField("CoOwnerMailState82040").display = display.hidden;
this.getField("CoOwnerMailZipCode82040").display = display.hidden;
this.getField("CkBxSameCoOwnerMailAddress82040").display = display.hidden;
this.getField("CoOwnerPhysicalAddress82040").display = display.hidden;
this.getField("CoOwnerPhysicalCity82040").display = display.hidden;
this.getField("CoOwnerPhysicalState82040").display = display.hidden;
this.getField("CoOwnerPhysicalZipCode82040").display = display.hidden;
this.getField("CoOwnerSignature82040").display = display.hidden;
this.getField("CoOwnerSignDate82040").display = display.hidden;
this.getField("CoOwnerSignature84490").display = display.hidden;
this.getField("CoOwnerSignature84491").display = display.hidden;
}



TOPICS
Acrobat SDK and JavaScript

Views

383

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 ,
Jul 17, 2023 Jul 17, 2023

Copy link to clipboard

Copied

Those errors mean you specified an incorrect field name. Go to the number line indicated (11, 31, etc.) and check around it if any of the names you used are not typed correctly. Even a single character off (like "O" instead of "o", or a space) will cause it to fail.

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
Contributor ,
Jul 20, 2023 Jul 20, 2023

Copy link to clipboard

Copied

Thank you Try67 for your response. Apologize for not returning sooner. I finally just started over with a clean slate, checking each script as I go. Learning how to read the console though! Thank you again for taking your time to lend a helping hand!! Awesome!!!

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
Contributor ,
Jul 17, 2023 Jul 17, 2023

Copy link to clipboard

Copied

Hi Try67; did that and also cut/pasted names directly into script. Nothing corrected the issue. Removed phone field fomat. Even substitued 'Date' fields with Text fields formatted with a date setting  mm/dd/yyyy. Also tried running the scripts individually. Nothing changed, still the errors I mentioned earlier. Other suggestions? Thanks in advance- kemper

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 ,
Jul 18, 2023 Jul 18, 2023

Copy link to clipboard

Copied

You can get the information about the missing fields when you define following function:

function f_getField(name)
{
	var fld = this.getField(name);
	if (!fld) {
		console.show();
		console.println("Missing field: '" + name + "'");
	}
	return fld;
}

 

Use the function like this:

f = f_getField("RBCoOwnerResident82040");
if (f) f.display = display.visible;

 

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 ,
Jul 18, 2023 Jul 18, 2023

Copy link to clipboard

Copied

Can you post the form?

 

 

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
Contributor ,
Jul 20, 2023 Jul 20, 2023

Copy link to clipboard

Copied

LATEST

Thank you Thom for your interest and your response. Apologize for not returning sooner. I finally just started over with a clean slate, checking each script as I go. Learning how to read the console though! Thank you again for taking your time to lend a helping hand!! Thanks for all you do here in the community!!! Just Awesome!!!!

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
Contributor ,
Jul 20, 2023 Jul 20, 2023

Copy link to clipboard

Copied

Way over my head Bernd! Thank you Bernd for your response. Apologize for not returning sooner. I finally just started over with a clean slate, checking each script as I go. Learning how to read the console though! Thank you again for taking your time to lend a helping hand!! Thanks for all you do here in the community!!!Awesome!!!!

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