Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

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

Avatar

Avatar
Level 1
service_commun1
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile

Avatar
Level 1
service_commun1
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile
service_commun1
Level 1

20-03-2017

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 !

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar
Validate 1
Level 4
MinusZero
Level 4

Likes

30 likes

Total Posts

326 posts

Correct Reply

54 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 4
MinusZero
Level 4

Likes

30 likes

Total Posts

326 posts

Correct Reply

54 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
MinusZero
Level 4

21-03-2017

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

}