Variable Color Font based on text input

Hello,

Product is Adobe Acrobat XI.

Scenario:
Fillable PDF created. In Text Fields, I'd like to change the color of the font OR the color of the text field box (whichever is easier) entered depending on the entry (for example: if the letter "P" is entered, turn either the font or the box to the color green. If the letter "F" is entered, turn either one of them red).

I'm relatively knew to the product so any assistance would be great.


Max Joy


2 Answers

Voted Best Answer

Changing the fillColor may not give you the results you are looking for: When a user has the "Highlight Existing Fields" function selected, the fields that are not active will always look blue. Only when you click in such a field, will the background color be shown. What I do is in addition to changing the background color, I also change the border color via the strokeColor property. The border stroke color will be shown even when the highlighting feature is active.

Karl Heinz Kremer
PDF Acrobatics Without a Net
PDF Software Development, Training and More...
http://www.khkonsulting.com


By Karl Heinz Kremer   

Use this code as the field's custom validation script:

if (event.value=="P") event.target.textColor = color.green;
else if (event.value=="F") event.target.textColor = color.red;
else event.target.textColor = color.black;

To change the fill color instead of the text color use fillColor instead of textColor in the code above.

.


Visit my custom-made PDF scripts website: http://try67.blogspot.com
Contact me personally: try6767@gmail.com


Gilad D (try67)   


Please specify a reason: