Skip to main content
Inspiring
May 9, 2017
Answered

Javascript not working

  • May 9, 2017
  • 2 replies
  • 16193 views

Hello everyone,

I created a form with some JavaScript functionality. It works in Adobe Acrobat DC, but it doesn't work in Reader on our company website.

Is there a reason for this?

Thanks,

Jake

This topic has been closed for replies.
Correct answer Joel Geraci

Yes I've just checked on Chrome and Explorer.

However, I have just found out that the JavaScript actions are no longer on the form fields.

Is there any way this could have happened, other than someone doing it manually?

My original PDF has the JavaScript action. I sent it to our Marketing department to put on the website and now the JavaScript actions aren't there.


I’m going to guess that the marketing department opened it in Preview on OSX and then saved the file… or inadvertently saved it after some minor change. Preview... without warning... removes scripts from PDF form fields every chance it gets.

J-

2 replies

try67
Community Expert
Community Expert
May 9, 2017

What kind of "functionality"?

Inspiring
May 11, 2017

All I am doing is adding JavaScript to form fields:

function check () {

//Foot Options is the name of the radio button group

//Javelin is the name of the radio button

//If the selected radio button isn't called Javelin

if(this.getField("Foot Options").value != "Javelin"){

//Don't allow both to be selected

this.resetForm("Top Housing");

}

}

check();

Joel Geraci
Community Expert
Community Expert
May 11, 2017

resetForm takes either nothing or an array as a parameter. See the brackets around your field name below.

function check () {

//Foot Options is the name of the radio button group

//Javelin is the name of the radio button

//If the selected radio button isn't called Javelin

if(this.getField("Foot Options").value != "Javelin"){

//Don't allow both to be selected

this.resetForm(["Top Housing"]);

}

}

check();

Bernd Alheit
Community Expert
Community Expert
May 9, 2017

Acrobat Reader doesn't support all JavaScript features.