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

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

223

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

Copy link to clipboard

Copied

LATEST

Try this:

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

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