1 Reply Latest reply on Mar 21, 2017 12:12 AM by MinusZero

    Change fillcolor if there's a value (javascript/pdf/acrobat)

    service communis96070673 Level 1

      Hello everyone, i'm looking for a javascript that could change a fillcolor when the textfield is filled with text, but on a document javascript, not on validation script.

      Anyone know how to do this ? It would be huge help for me !

       

      Thanks !

        • 1. Re: Change fillcolor if there's a value (javascript/pdf/acrobat)
          MinusZero Level 1

          I would place the javascript in the exit event.

           

          This code will colour the whole field (including caption) if when exited the field is not empty. If it becomes empty again, the colour returns to white. If you dont want to colour the caption as well, set the field to have no caption and just add a text object next to it.

           

          TextField1:exit (Javascript)

          if(this.rawValue != null)

          {

          this.border.fill.color.value = "150, 150, 150"; //RGB colour grey

          }

          else

          {

          this.border.fill.color.value = "255, 255, 255"; //RGB colour white

          }

           

           

          If you prefer just to colour the borders of the object when exited, change fill for edge.

          TextField1:exit (Javascript)

          if(this.rawValue != null)

          {

          this.border.edge.color.value = "150, 150, 150"; //RGB colour grey

          }

          else

          {

          this.border.edge.color.value = "255, 255, 255"; //RGB colour white

          }