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

Highlight Text Lines Based on Dropdown Selection

New Here ,
Dec 17, 2019 Dec 17, 2019

Copy link to clipboard

Copied

Hello, I've search to no avail. I want to highlight certain text lines on a pdf form if the user selects a particular option from a dropdown list on the form. The text I want to highlight is not text fields but just regular text in the document. Thanks!

TOPICS
Acrobat SDK and JavaScript

Views

2.0K

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
New Here ,
Mar 12, 2020 Mar 12, 2020

Copy link to clipboard

Copied

Will this work for multiple fields same drop down? to clarify:

I will need to update the java console for each field using the following:

selectedAnnots[0].hidden = true;
selectedAnnots[0].name = "HG2";

selectedAnnots[0].hidden = false;

 

selectedAnnots[0].hidden = true;
selectedAnnots[0].name = "HG3";

selectedAnnots[0].hidden = false;

 etc...

 

Then in the dropdown properties add the following to the existing custom valitation script:

var ann = this.getAnnot(0, "HG2");

if (ann) ann.hidden = (event.value!="Model Maintenance");

var ann = this.getAnnot(0, "HG3");

if (ann) ann.hidden = (event.value!="Model Maintenance");

 

Correct?

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 ,
Mar 12, 2020 Mar 12, 2020

Copy link to clipboard

Copied

The first code has to be done in steps:

- Select the first comment.

- Run the code from the Console to set its name to "HG1".

- Select the second comment.

- Run the code from the Console to set its name to "HG2".

- etc.

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
New Here ,
Mar 12, 2020 Mar 12, 2020

Copy link to clipboard

Copied

Thank you. I have the code working in the console to make the text highlight visiable and hidden. However, it doesnt work with the drop down.

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
New Here ,
Mar 12, 2020 Mar 12, 2020

Copy link to clipboard

Copied

LATEST

Thank you try67... It was a user error on the code for the dropdown.. I have it functioning for multiple text lines.

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