Problem within a textbox changing color

New Here ,
Apr 10, 2019 Apr 10, 2019

Copy link to clipboard

Copied

Hi,

I have a javascript problem with the following code:

var sl = this.getField("Heuvel-0");

if (sl.value == "")

{event.target.fillColor=color.white;}

else

{if(sl.value==0)

     {event.target.fillColor=color.green;

      event.target.textColor=color.red;}

     else

     {if(sl.value>=-.4 && sl.value<=+.4)

          {event.target.fillColor=color.yellow;

           event.target.textColor=color.red;}

          else

          {event.target.fillColor=color.red;

           event.target.TextColor=color.white;}

     }

}

everything works except for the 0 value. The box doesnt change to green. When I change it to a 1 in the code and the box everything works fine. Why can't I use the 0?

TOPICS
Acrobat SDK and JavaScript, Windows

Views

56

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 ,
Apr 10, 2019 Apr 10, 2019

Copy link to clipboard

Copied

LATEST

Try this:

if(Number(sl.valueAsString)==0)

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