Skip to main content
JR Boulay
Community Expert
Community Expert
January 14, 2021
Answered

Ghost JavaScript

  • January 14, 2021
  • 2 replies
  • 666 views

Bonjour et bonne année

 

I need to understand.

A client sent me this form made with Acrobat Pro, in which there is a drop-down menu, in which there is a JavaScript acting on the boxes located below, and it works very well.

 

The problem is that this JavaScript script does not appear anywhere, neither in the Actions of the field, nor in "all JavaScripts", etc.

If we try to add another action in this drop-down list, it deletes the existing script.

And if you deactivate JavaScript in the Preferences it no longer works.

 

The client assures me that this file was made like the others which do not pose this problem and that it has not undergone any particular treatment.

 

Is this a known bug or is it brand new?

 

The culprit file is here: https://documentcloud.adobe.com/link/track?uri=urn:aaid:scds:US:17536fea-de12-4d2a-a825-dca3fe66db9d

This topic has been closed for replies.
Correct answer try67

This is a kind of bug in Acrobat. The code is located under the Keystroke event of the drop-down field but because it contains a string ("AF") that Acrobat considers to be an indicator that an internal, undocumented function is used, it doesn't display it. If you examine the file using a PDF debugger tool you'll see that it's there. Here's the full code:

 

 

if (!event.willCommit) {
if (event.changeEx  =="A Renseigner") {
this.getField("Text61.0.0").fillColor = color.black;
this.getField("Text61.0.1").fillColor = color.black;
this.getField("Text61.0.2").fillColor = color.black;
this.getField("Text61.0.3").fillColor = color.black;
this.getField("Text61.0.4").fillColor = color.black;
this.getField("Text61.1.0").fillColor = color.black;
this.getField("Text61.1.1").fillColor = color.black;
this.getField("Text61.1.2").fillColor = color.black;
this.getField("Text61.1.3").fillColor = color.black;
this.getField("Text61.1.4").fillColor = color.black;
this.getField("Text61.0.0").readonly = true;
this.getField("Text61.0.1").readonly = true;
this.getField("Text61.0.2").readonly = true;
this.getField("Text61.0.3").readonly = true;
this.getField("Text61.0.4").readonly = true;
this.getField("Text61.1.0").readonly = true;
this.getField("Text61.1.1").readonly = true;
this.getField("Text61.1.2").readonly = true;
this.getField("Text61.1.3").readonly = true;
this.getField("Text61.1.4").readonly = true;
}

else if (event.changeEx  == "DAF 800") {
this.getField("Text61.0.0").fillColor = color.transparent;
this.getField("Text61.0.1").fillColor = color.transparent;
this.getField("Text61.0.2").fillColor = color.black;
this.getField("Text61.0.3").fillColor = color.black;
this.getField("Text61.0.4").fillColor = color.black;
this.getField("Text61.1.0").fillColor = color.transparent;
this.getField("Text61.1.1").fillColor = color.transparent;
this.getField("Text61.1.2").fillColor = color.black;
this.getField("Text61.1.3").fillColor = color.black;
this.getField("Text61.1.4").fillColor = color.black;
this.getField("Text61.0.0").readonly = false;
this.getField("Text61.0.1").readonly = false;
this.getField("Text61.0.2").readonly = true;
this.getField("Text61.0.3").readonly = true;
this.getField("Text61.0.4").readonly = true;
this.getField("Text61.1.0").readonly = false;
this.getField("Text61.1.1").readonly = false;
this.getField("Text61.1.2").readonly = true;
this.getField("Text61.1.3").readonly = true;
this.getField("Text61.1.4").readonly = true;
}


else if (event.changeEx=="DAF 1200"){
this.getField("Text61.0.0").fillColor = color.transparent;
this.getField("Text61.0.1").fillColor = color.transparent;
this.getField("Text61.0.2").fillColor = color.transparent;
this.getField("Text61.0.3").fillColor = color.black;
this.getField("Text61.0.4").fillColor = color.black;
this.getField("Text61.1.0").fillColor = color.transparent;
this.getField("Text61.1.1").fillColor = color.transparent;
this.getField("Text61.1.2").fillColor = color.transparent;
this.getField("Text61.1.3").fillColor = color.black;
this.getField("Text61.1.4").fillColor = color.black;
this.getField("Text61.0.0").readonly = false;
this.getField("Text61.0.1").readonly = false;
this.getField("Text61.0.2").readonly = false;
this.getField("Text61.0.3").readonly = true;
this.getField("Text61.0.4").readonly = true;
this.getField("Text61.1.0").readonly = false;
this.getField("Text61.1.1").readonly = false;
this.getField("Text61.1.2").readonly = false;
this.getField("Text61.1.3").readonly = true;
this.getField("Text61.1.4").readonly = true;
}

else if (event.changeEx=="DAF 1600"){
this.getField("Text61.0.0").fillColor = color.transparent;
this.getField("Text61.0.1").fillColor = color.transparent;
this.getField("Text61.0.2").fillColor = color.transparent;
this.getField("Text61.0.3").fillColor = color.transparent;
this.getField("Text61.0.4").fillColor = color.black;
this.getField("Text61.1.0").fillColor = color.transparent;
this.getField("Text61.1.1").fillColor = color.transparent;
this.getField("Text61.1.2").fillColor = color.transparent;
this.getField("Text61.1.3").fillColor = color.transparent;
this.getField("Text61.1.4").fillColor = color.black;
this.getField("Text61.0.0").readonly = false;
this.getField("Text61.0.1").readonly = false;
this.getField("Text61.0.2").readonly = false;
this.getField("Text61.0.3").readonly = false;
this.getField("Text61.0.4").readonly = true;
this.getField("Text61.1.0").readonly = false;
this.getField("Text61.1.1").readonly = false;
this.getField("Text61.1.2").readonly = false;
this.getField("Text61.1.3").readonly = false;
this.getField("Text61.1.4").readonly = true;
}


else if (event.changeEx== "DAF 2000") {
this.getField("Text61.0.0").fillColor = color.transparent;
this.getField("Text61.0.1").fillColor = color.transparent;
this.getField("Text61.0.2").fillColor = color.transparent;
this.getField("Text61.0.3").fillColor = color.transparent;
this.getField("Text61.0.4").fillColor = color.transparent;
this.getField("Text61.1.0").fillColor = color.transparent;
this.getField("Text61.1.1").fillColor = color.transparent;
this.getField("Text61.1.2").fillColor = color.transparent;
this.getField("Text61.1.3").fillColor = color.transparent;
this.getField("Text61.1.4").fillColor = color.transparent;
this.getField("Text61.0.0").readonly = false;
this.getField("Text61.0.1").readonly = false;
this.getField("Text61.0.2").readonly = false;
this.getField("Text61.0.3").readonly = false;
this.getField("Text61.0.4").readonly = false;
this.getField("Text61.1.0").readonly = false;
this.getField("Text61.1.1").readonly = false;
this.getField("Text61.1.2").readonly = false;
this.getField("Text61.1.3").readonly = false;
this.getField("Text61.1.4").readonly = false;
}

else {
this.getField("Text61.0.0").fillColor = color.transparent;
this.getField("Text61.0.1").fillColor = color.transparent;
this.getField("Text61.0.2").fillColor = color.transparent;
this.getField("Text61.0.3").fillColor = color.transparent;
this.getField("Text61.0.4").fillColor = color.transparent;
this.getField("Text61.1.0").fillColor = color.transparent;
this.getField("Text61.1.1").fillColor = color.transparent;
this.getField("Text61.1.2").fillColor = color.transparent;
this.getField("Text61.1.3").fillColor = color.transparent;
this.getField("Text61.1.4").fillColor = color.transparent;
this.getField("Text61.0.0").readonly = false;
this.getField("Text61.0.1").readonly = false;
this.getField("Text61.0.2").readonly = false;
this.getField("Text61.0.3").readonly = false;
this.getField("Text61.0.4").readonly = false;
this.getField("Text61.1.0").readonly = false;
this.getField("Text61.1.1").readonly = false;
this.getField("Text61.1.2").readonly = false;
this.getField("Text61.1.3").readonly = false;
this.getField("Text61.1.4").readonly = false;
}
}

 

 

2 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
January 14, 2021

This is a kind of bug in Acrobat. The code is located under the Keystroke event of the drop-down field but because it contains a string ("AF") that Acrobat considers to be an indicator that an internal, undocumented function is used, it doesn't display it. If you examine the file using a PDF debugger tool you'll see that it's there. Here's the full code:

 

 

if (!event.willCommit) {
if (event.changeEx  =="A Renseigner") {
this.getField("Text61.0.0").fillColor = color.black;
this.getField("Text61.0.1").fillColor = color.black;
this.getField("Text61.0.2").fillColor = color.black;
this.getField("Text61.0.3").fillColor = color.black;
this.getField("Text61.0.4").fillColor = color.black;
this.getField("Text61.1.0").fillColor = color.black;
this.getField("Text61.1.1").fillColor = color.black;
this.getField("Text61.1.2").fillColor = color.black;
this.getField("Text61.1.3").fillColor = color.black;
this.getField("Text61.1.4").fillColor = color.black;
this.getField("Text61.0.0").readonly = true;
this.getField("Text61.0.1").readonly = true;
this.getField("Text61.0.2").readonly = true;
this.getField("Text61.0.3").readonly = true;
this.getField("Text61.0.4").readonly = true;
this.getField("Text61.1.0").readonly = true;
this.getField("Text61.1.1").readonly = true;
this.getField("Text61.1.2").readonly = true;
this.getField("Text61.1.3").readonly = true;
this.getField("Text61.1.4").readonly = true;
}

else if (event.changeEx  == "DAF 800") {
this.getField("Text61.0.0").fillColor = color.transparent;
this.getField("Text61.0.1").fillColor = color.transparent;
this.getField("Text61.0.2").fillColor = color.black;
this.getField("Text61.0.3").fillColor = color.black;
this.getField("Text61.0.4").fillColor = color.black;
this.getField("Text61.1.0").fillColor = color.transparent;
this.getField("Text61.1.1").fillColor = color.transparent;
this.getField("Text61.1.2").fillColor = color.black;
this.getField("Text61.1.3").fillColor = color.black;
this.getField("Text61.1.4").fillColor = color.black;
this.getField("Text61.0.0").readonly = false;
this.getField("Text61.0.1").readonly = false;
this.getField("Text61.0.2").readonly = true;
this.getField("Text61.0.3").readonly = true;
this.getField("Text61.0.4").readonly = true;
this.getField("Text61.1.0").readonly = false;
this.getField("Text61.1.1").readonly = false;
this.getField("Text61.1.2").readonly = true;
this.getField("Text61.1.3").readonly = true;
this.getField("Text61.1.4").readonly = true;
}


else if (event.changeEx=="DAF 1200"){
this.getField("Text61.0.0").fillColor = color.transparent;
this.getField("Text61.0.1").fillColor = color.transparent;
this.getField("Text61.0.2").fillColor = color.transparent;
this.getField("Text61.0.3").fillColor = color.black;
this.getField("Text61.0.4").fillColor = color.black;
this.getField("Text61.1.0").fillColor = color.transparent;
this.getField("Text61.1.1").fillColor = color.transparent;
this.getField("Text61.1.2").fillColor = color.transparent;
this.getField("Text61.1.3").fillColor = color.black;
this.getField("Text61.1.4").fillColor = color.black;
this.getField("Text61.0.0").readonly = false;
this.getField("Text61.0.1").readonly = false;
this.getField("Text61.0.2").readonly = false;
this.getField("Text61.0.3").readonly = true;
this.getField("Text61.0.4").readonly = true;
this.getField("Text61.1.0").readonly = false;
this.getField("Text61.1.1").readonly = false;
this.getField("Text61.1.2").readonly = false;
this.getField("Text61.1.3").readonly = true;
this.getField("Text61.1.4").readonly = true;
}

else if (event.changeEx=="DAF 1600"){
this.getField("Text61.0.0").fillColor = color.transparent;
this.getField("Text61.0.1").fillColor = color.transparent;
this.getField("Text61.0.2").fillColor = color.transparent;
this.getField("Text61.0.3").fillColor = color.transparent;
this.getField("Text61.0.4").fillColor = color.black;
this.getField("Text61.1.0").fillColor = color.transparent;
this.getField("Text61.1.1").fillColor = color.transparent;
this.getField("Text61.1.2").fillColor = color.transparent;
this.getField("Text61.1.3").fillColor = color.transparent;
this.getField("Text61.1.4").fillColor = color.black;
this.getField("Text61.0.0").readonly = false;
this.getField("Text61.0.1").readonly = false;
this.getField("Text61.0.2").readonly = false;
this.getField("Text61.0.3").readonly = false;
this.getField("Text61.0.4").readonly = true;
this.getField("Text61.1.0").readonly = false;
this.getField("Text61.1.1").readonly = false;
this.getField("Text61.1.2").readonly = false;
this.getField("Text61.1.3").readonly = false;
this.getField("Text61.1.4").readonly = true;
}


else if (event.changeEx== "DAF 2000") {
this.getField("Text61.0.0").fillColor = color.transparent;
this.getField("Text61.0.1").fillColor = color.transparent;
this.getField("Text61.0.2").fillColor = color.transparent;
this.getField("Text61.0.3").fillColor = color.transparent;
this.getField("Text61.0.4").fillColor = color.transparent;
this.getField("Text61.1.0").fillColor = color.transparent;
this.getField("Text61.1.1").fillColor = color.transparent;
this.getField("Text61.1.2").fillColor = color.transparent;
this.getField("Text61.1.3").fillColor = color.transparent;
this.getField("Text61.1.4").fillColor = color.transparent;
this.getField("Text61.0.0").readonly = false;
this.getField("Text61.0.1").readonly = false;
this.getField("Text61.0.2").readonly = false;
this.getField("Text61.0.3").readonly = false;
this.getField("Text61.0.4").readonly = false;
this.getField("Text61.1.0").readonly = false;
this.getField("Text61.1.1").readonly = false;
this.getField("Text61.1.2").readonly = false;
this.getField("Text61.1.3").readonly = false;
this.getField("Text61.1.4").readonly = false;
}

else {
this.getField("Text61.0.0").fillColor = color.transparent;
this.getField("Text61.0.1").fillColor = color.transparent;
this.getField("Text61.0.2").fillColor = color.transparent;
this.getField("Text61.0.3").fillColor = color.transparent;
this.getField("Text61.0.4").fillColor = color.transparent;
this.getField("Text61.1.0").fillColor = color.transparent;
this.getField("Text61.1.1").fillColor = color.transparent;
this.getField("Text61.1.2").fillColor = color.transparent;
this.getField("Text61.1.3").fillColor = color.transparent;
this.getField("Text61.1.4").fillColor = color.transparent;
this.getField("Text61.0.0").readonly = false;
this.getField("Text61.0.1").readonly = false;
this.getField("Text61.0.2").readonly = false;
this.getField("Text61.0.3").readonly = false;
this.getField("Text61.0.4").readonly = false;
this.getField("Text61.1.0").readonly = false;
this.getField("Text61.1.1").readonly = false;
this.getField("Text61.1.2").readonly = false;
this.getField("Text61.1.3").readonly = false;
this.getField("Text61.1.4").readonly = false;
}
}

 

 

JR Boulay
Community Expert
JR BoulayCommunity ExpertAuthor
Community Expert
January 14, 2021

Thank you!

You make my day.

Acrobate du PDF, InDesigner et Photoshopographe
Bernd Alheit
Community Expert
Community Expert
January 14, 2021

What script does you use in the form?