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

Simple Show Hide Button

Participant ,
Apr 04, 2016 Apr 04, 2016

Copy link to clipboard

Copied

I have been through the forum and this make sense to me but can't see to get this to work.  I have this set up on click to run script. Please help.

var title = this.getField ("ButtonToHide");

if (this.getField("info_Company Name").value == "MyCompany")

{ title.display = display.visible; }

else

{ title.display = display.hidden; }

TOPICS
Acrobat SDK and JavaScript

Views

545

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

Participant , Apr 04, 2016 Apr 04, 2016

Don't know why this was the issue but var title was the problem.  I renamed it and it works great.


var HideButton = this.getField ("ButtonToHide");

if (this.getField("info_Company Name").value == "MyCompany")

{ HideButton.display = display.visible; }

else

{ HideButton.display = display.hidden; }

Votes

Translate

Translate
LEGEND ,
Apr 04, 2016 Apr 04, 2016

Copy link to clipboard

Copied

Have you opened the Acrobat JavaScript console to see if there are any errors?

I expect you have a bad form field name where the name of the field does not exactly match the name being used in the script. Spelling, capitalization, and presence of special characters are all important.

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
Participant ,
Apr 04, 2016 Apr 04, 2016

Copy link to clipboard

Copied

Don't know why this was the issue but var title was the problem.  I renamed it and it works great.


var HideButton = this.getField ("ButtonToHide");

if (this.getField("info_Company Name").value == "MyCompany")

{ HideButton.display = display.visible; }

else

{ HideButton.display = display.hidden; }

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 ,
Apr 04, 2016 Apr 04, 2016

Copy link to clipboard

Copied

"title" is a built-in property name of the Document object, so you had a conflict when you tried to define a variable with that name.

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
LEGEND ,
Apr 04, 2016 Apr 04, 2016

Copy link to clipboard

Copied

LATEST

I would expect that the word "title" is a keyword within Acrobat JavaScript, JavaScript, or you have defined it elsewhere in your form.

I have not problem using it a PDF form.

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