Javascript: Change Texcolor for a assigned number

Community Beginner ,
Jan 21, 2021 Jan 21, 2021

Copy link to clipboard

Copied

Hello i need Help please.

Iam searching for a Script to change the Text-Colour to red if i type the Number "5" in a certain Textfield in Acrobat (i am not used to JavaScript so i dont know much about it). There are lots of Texfields and i need the Script for all of them (not only for one specific Field).

I dont know what to do, tried a lot of different scripts but none of them worked yet. Would be great if someone could solve my Problem. Thank you!!

TOPICS
JavaScript, PDF forms

Views

269

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 , Jan 21, 2021 Jan 21, 2021
Place this script as a "Document level Javascript" : function check5() { if (event.value == 5) {event.target.textColor = color.red;} else {event.target.textColor = color.black;} } Then you just have to call this function from each field, using this script as a "Validation script": check5();

Likes

Translate

Translate
Adobe Community Professional ,
Jan 21, 2021 Jan 21, 2021

Copy link to clipboard

Copied

Place this script as a "Document level Javascript" :

 

function check5() {
if (event.value == 5) {event.target.textColor = color.red;}
else {event.target.textColor = color.black;}
}

 

 

Then you just have to call this function from each field, using this script as a "Validation script":

 

check5();

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
Community Beginner ,
Jan 21, 2021 Jan 21, 2021

Copy link to clipboard

Copied

LATEST

Perfect – thank you! It works and this helpes a lot. 

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