Skip to main content
Okt. 3, 2019 8:52 PM UTC
Beantwortet

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

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');};

 

====

 

Dieses Thema wurde für Antworten geschlossen.
JR Boulay
JR BoulayAntwort
Community Expert
Okt. 4, 2019 8:53 PM UTC

Hi

 

You should try this great free tool : http://practicalpdf.com/the-practicalpdf-date-library-for-adobe-acrobat/

Acrobate du PDF, InDesigner et Photoshopographe

4 Antworten

JR Boulay
Community Expert
JR BoulayCommunity ExpertAntwort
Community Expert
Okt. 4, 2019 8:53 PM UTC

Hi

 

You should try this great free tool : http://practicalpdf.com/the-practicalpdf-date-library-for-adobe-acrobat/

Übersetzen
Acrobate du PDF, InDesigner et Photoshopographe
Okt. 7, 2019 2:59 PM UTC
Thank you ! It's Great !!!
Übersetzen
Inspiring
Okt. 3, 2019 9:30 PM UTC

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.

Übersetzen
Okt. 3, 2019 10:43 PM UTC
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.
Übersetzen