Script needed for color change for certain word

New Here ,
May 31, 2022 May 31, 2022

Copy link to clipboard

Copied

I am trying to change the color of the text based on whenever specific words are typed in by others. For example, for the term "due," I would like the word to turn red in the text fill block and the abbreviation "c/w" to turn green in the same block.

TOPICS
Create PDFs , Edit and convert PDFs , General troubleshooting , JavaScript , PDF forms

Views

31

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 Employee ,
May 31, 2022 May 31, 2022

Copy link to clipboard

Copied

Hi Jeremy

 

Hope you are doing well and thanks for reaching out.

 

The workflow that you are trying to achieve is possible using custom JavaScript. For more information, please check the help pages listed below:

https://helpx.adobe.com/acrobat/using/applying-actions-scripts-pdfs.html

https://acrobatusers.com/tutorials/javascript_console/

 

Regards

Amal

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 31, 2022 May 31, 2022

Copy link to clipboard

Copied

LATEST

Is that text field or text box and will those two words be at the same time in field or one at a time?

If it's text field and one word at a time, you can use this as validation script of that field:

if(event.value == "due")
event.target.textColor = color.red;
else if(event.value == "c/w")
event.target.textColor = color.green;
else
event.target.textColor = color.black;

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