Copy link to clipboard
Copied
Hi
I prepared a document with a form text field. The custom validation script for each field is as follows:
if (event.value=="No Stock")
event.target.fillColor = color.red;
else if (event.value=="Medium")
event.target.fillColor = color.yellow;
else if (event.value=="High")
event.target.fillColor = color.green;
else if (event.value=="")
event.target.fillColor = color.transparent;
Basically, it is working fine in Adobe Reader DC Pro for me and my collegues
But in all other Adobe Reader versions (e.g. Adobe Reader DC), the coloring is not permanent only when you hover over the field and click on it you can see it.
And I don't understand what I am doing wrong!
Thanks already for the help and suggestions
It seems your runtimeHighlight property is set to true. You can use this script in document level:
app.runtimeHighlight = false;
or use this script:
if (app.runtimeHighlight) app.runtimeHighlight = false;
if (event.value=="No Stock") event.target.fillColor = color.red;
else if (event.value=="Medium") event.target.fillColor = color.yellow;
else if (event.value=="High") event.target.fillColor = color.green;
else event.target.fillColor = color.transparent;
I modifyed a bit your script because what
...Copy link to clipboard
Copied
You have fields highlight turned on.
Copy link to clipboard
Copied
Thank you a simple way to solve it is if I have a pool of people and can control their properties! Thanks:)
Copy link to clipboard
Copied
It seems your runtimeHighlight property is set to true. You can use this script in document level:
app.runtimeHighlight = false;
or use this script:
if (app.runtimeHighlight) app.runtimeHighlight = false;
if (event.value=="No Stock") event.target.fillColor = color.red;
else if (event.value=="Medium") event.target.fillColor = color.yellow;
else if (event.value=="High") event.target.fillColor = color.green;
else event.target.fillColor = color.transparent;
I modifyed a bit your script because what happens if the text is anything else???
You will maybe need to set the runtimeHighlight property to true after that (or not) !!! That can be done when you close the file for example.
app.runtimeHighlight = true;
Copy link to clipboard
Copied
Simple and nice! This works well after I set the app.runtimehighlight=true; it works strictly as intended! Thank you so much. Also, the addition makes sense; I did not think about it that someone would write anything else inside the text fields, haha! Just great!
Copy link to clipboard
Copied
Be aware, though, that this changes this setting for all documents the user will open, not just for yours. It might be a good idea of informing them of that change, or (even better) to get their permission for doing it.
Copy link to clipboard
Copied
ok well noted thank you! when I send it, I will inform them accordingly!