Skip to main content
Inspiring
August 14, 2017
Answered

Set Different Default Highlight Colors For Fields?

  • August 14, 2017
  • 2 replies
  • 2259 views

Is it possible to set different default field highlight colors? Adobe Pro X

For example; the below code I found sets all document highlights to red

if (!app.viewerVersion < 6) { // for version 6 or above

app.runtimeHighlight = true; // turnon field highlighting

app.runtimeHighlightColor = color.red; // set field color

}

Is it possible to set a default field highlight of "textField1" with a color.blue and "textField2" to color.red?

I tried the script below for giggles: (of course, it did not work)

var test1 = this.getField("textField1");
var test2 = this.getField("textField2");

test1.runtimeHighlightColor = color.blue;

test2.runtimeHighlightColor = color.red;

I couldn't find anything in the API reference either.

This topic has been closed for replies.
Correct answer Joel Geraci

The solution to what you describe requires a lot of scripting.

And you actually do want the fillColor; you just have to be clever with it. You'd use JavaScript to turn off the application level highlighting for your document only. Then you'd use the fillColor to "highlight" the different sets of fields with the colors you want and use document events like "WillPrint" and "DidPrint" etc.  to set the fillColor to transparent before printing then back to what you want after printing.

2 replies

awbrown66Author
Inspiring
August 15, 2017

No, the field fillColor is not what I'm looking for ... I'm using Acrobat X Pro and when a form is first opened, and it contains active fields, the active fields have a default "bluish" highlight (That is, if the "Highlight Existing Fields" button is selected, or a JavaScript with "app.runtimeHighlight = true;" has been run). These highlights are not printed either (which is what I want)

The highlights only purpose is to show the user that the fields are there... the "app." level property will change this default setting to any other color, but as far as I can tell it is global (as in all field highlights are changed at once) and the fields cannot be separated using this method. (maybe I'm wrong?)

The fillColor does not affect these "bluish" highlights; in fact, if one adds a fillColor to a field, the "bluish" highlight covers the fill color until the user clicks into the field.... so my question goes back to the original, and maybe someone else could provide the answer to this...... ?

Is there a property that can be used to set more than one default field highlight color (not fillColor)?
Example: Half of the form field highlight is red and the other half is blue?

I was hoping for a much simpler solution not requiring a lot of scripting.

try67
Community Expert
Community Expert
August 15, 2017

Is there a property that can be used to set more than one default field highlight color (not fillColor)?

No.

Joel Geraci
Community Expert
Joel GeraciCommunity ExpertCorrect answer
Community Expert
August 15, 2017

The solution to what you describe requires a lot of scripting.

And you actually do want the fillColor; you just have to be clever with it. You'd use JavaScript to turn off the application level highlighting for your document only. Then you'd use the fillColor to "highlight" the different sets of fields with the colors you want and use document events like "WillPrint" and "DidPrint" etc.  to set the fillColor to transparent before printing then back to what you want after printing.

Joel Geraci
Community Expert
Community Expert
August 14, 2017

The app object properties runtimeHighlight and runtimeHighlightColor are application level properties... notice the bold. What you're looking for is the field fillColor property that you'd change based on some field condition or event.