Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


User to highlight words by clicking on text

New Here ,
Apr 15, 2021 Apr 15, 2021

Copy link to clipboard

Copied

I have a fillable form all ready to go except for one thing.  I am looking to make certain words "highlightable" or just a plain underline by the user just clicking on it.  Is this possible? I am very new to this and no nothing about programming.

TOPICS
Create PDFs, Edit and convert PDFs, How to, PDF forms

Views

848

Likes

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

Adobe Community Professional , Apr 16, 2021 Apr 16, 2021
You need a script for it. But in order to write the script you first need to find out the "name" of the comment. To do that you need to select the comment by clicking it, then open the JS Console (Ctrl+J), and enter the following code into it and press Ctrl+Enter: selectedAnnots[0].name It will print out something like this: 1f7dc8a2-7702-4bca-a7f7-8ee7bb664c53 Copy that string and enter it into the following code, as the Mouse Up event of the button: var a = this.getAnnot(event.target.pag...

Likes

Translate

Translate
Adobe Community Professional ,
Apr 15, 2021 Apr 15, 2021

Copy link to clipboard

Copied

It's possible, but not that simple. It would require creating a highlight comment and a button over the text.

The button can then be used to show/hide the highlight comment each time you click it.

Likes

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 ,
Apr 15, 2021 Apr 15, 2021

Copy link to clipboard

Copied

So, I've created the highlight comment and a button over it.  When I click on it, it does nothing.  How do I make it so it will show and hide the highlight?

Likes

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
Adobe Community Professional ,
Apr 16, 2021 Apr 16, 2021

Copy link to clipboard

Copied

You need a script for it. But in order to write the script you first need to find out the "name" of the comment.

To do that you need to select the comment by clicking it, then open the JS Console (Ctrl+J), and enter the following code into it and press Ctrl+Enter:

 

selectedAnnots[0].name

 

It will print out something like this:

1f7dc8a2-7702-4bca-a7f7-8ee7bb664c53

Copy that string and enter it into the following code, as the Mouse Up event of the button:

 

var a = this.getAnnot(event.target.page, "PASTE COMMENT NAME HERE");

a.hidden = !a.hidden;

 

That's it. After you do that each time you click the button the highlight will appear or disappear.

 

Likes

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 ,
Apr 20, 2021 Apr 20, 2021

Copy link to clipboard

Copied

Genius!  Thank you so much!

Likes

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 ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

So here is another one for you!

 

I want a text box to become visible when they click on a checkbox.  The check should show up and text should show up on another portion of the form.  I have tried the Show/Hide Field, but it doesn't work.  What kind of script can I write to accomplish this?  I can find out what the text is "named" fine.

Likes

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
Adobe Community Professional ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

You can use something like this as the custom calculation script of the text field:

 

event.target.display = (this.getField("CheckBox1").valueAsString=="Off") ? display.hidden : display.visible;

 

Replace "CheckBox1" with the actual name of your check-box field.

Likes

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 ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

Yeah!  Thank you again!  That worked perfectly!

Likes

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 ,
May 07, 2021 May 07, 2021

Copy link to clipboard

Copied

Okay, so it works perfectly in Adobe Acrobat Pro DC but when I open the form in just Adobe Reader on my tablet it does not work?  I think I'm going crazy!

Likes

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
Adobe Community Professional ,
May 07, 2021 May 07, 2021

Copy link to clipboard

Copied

You're not. Unfortunately, almost no scripts will work on mobile devices.

If you're using an iOS device try it in PDF Expert by Readdle. If you're on an Android device try the XODO PDF Reader. Those apps have the best chances of it working.

Likes

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 ,
May 07, 2021 May 07, 2021

Copy link to clipboard

Copied

Well that stinks, didn't work with the other apps either.  Can you think of any other way to accomplish this task?

Likes

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
Adobe Community Professional ,
May 07, 2021 May 07, 2021

Copy link to clipboard

Copied

LATEST

Since you mentioned that it's OK to use an underline you can try the following:

Create just a button over the word and set it as having a transparent fill color, a black border color, and an underline border style. Then add this code as its Mouse Up script:

 

event.target.lineWidth = (event.target.lineWidth==0) ? 1 : 0;

 

Hopefully that will work in one of those apps (I haven't tested it in them, though).

Likes

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