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

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

655

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

Community Expert , 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();

Votes

Translate

Translate
Community Expert ,
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();

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

Copy link to clipboard

Copied

LATEST

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

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