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

How to change the text color in the text field according to the result of <if >

Guest
Oct 03, 2019 Oct 03, 2019

Copy link to clipboard

Copied

I want to change the text color in the text field to red according to the result, but I don't know how.
In the following cases, I want to change the result of "! Over!" to Red color.
I need your advice. Thank you.

 

====

 

var GetNextDAY = this.getField("Next-Birth-DAY").value;
var NextDAY = new Date(GetNextDAY);

var TODAY = new Date();
var HowMany = (NextDAY - TODAY)/24/60/60/1000;

 

if(TODAY > NextDAY){
                                 event.value = ('!Over!');}
                          else{event.value = (HowMany.toFixed()+'Days');};

 

====

 

TOPICS
Acrobat SDK and JavaScript

Views

429

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

Community Expert , Oct 04, 2019 Oct 04, 2019

Likes

Translate

Translate
LEGEND ,
Oct 03, 2019 Oct 03, 2019

Copy link to clipboard

Copied

1. What results are you getting?

 

2. Have you checked the Acrobat JavaScript console for errors?

 

It is best to use the util.scand method to obtain the date object for a date in a string format.

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
Guest
Oct 03, 2019 Oct 03, 2019

Copy link to clipboard

Copied

Is something wrong? At present, the result is as expected. Just only can not changing the text color. In other words, "over" is displayed if today is past the day of Birthday. And "** D" is displayed if today is earlier than Birthday.

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 Expert ,
Oct 04, 2019 Oct 04, 2019

Copy link to clipboard

Copied

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
Guest
Oct 07, 2019 Oct 07, 2019

Copy link to clipboard

Copied

LATEST
Thank you ! It's Great !!!

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