These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Highlight fields automatically in a Form

corley
Registered: Oct 19 2007
Posts: 23
Answered

Is there a way that a form I've made with Livecycle Designer 8 have the "highlight field" turned on by default for all my Adobe Reader users ?

lkassuba
ExpertTeam
Registered: Jun 28 2007
Posts: 3636
The form highlight field is a Preference in Acrobat, so you'll need to add a Javascipt to the PDF to make sure this Preference is turned on for your form.
You can add the following Javascript to the first page of your Acrobat form (Page Navigation Pane, right-click Page Properties, Actions Tab, Run a Javascript page action.
if (!app.runtimeHighlight){app.runtimeHighlight = true;app.runtimeHighlightColor = color.yellow;}

This turns the form highlighting on and sets the color to yellow.

For LiveCycle Designer forms you'll need to place this javascript code in the "DocReady" event for the form.

Lori Kassuba is an AUC Expert and Community Manager for AcrobatUsers.com.

brian.deer
Registered: Oct 21 2008
Posts: 5
I did this in Livecycle and opened my form in reader, but the default color of blue showed instead of the yellow as your code specifies. what might i do to change the color?

thanks,
Brian
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
The code:

if (!app.runtimeHighlight){...}
Causes the provided script to only use the yellow highlight if the "Highlight Form Fields" is in the not enabled state. If you want to force this not matter what, remove the "if" statement. You will only need these 2 lines of code:

app.runtimeHighlight = true;app.runtimeHighlightColor = color.yellow;

George Kaiser

dlettow
Registered: Jan 24 2008
Posts: 20
I used this code to turn field highlighting on in one document. Now that color (I used color.blue instead of color.yellow) is the highlighting color for every document I open. I've gone back to the original document and stripped out the Javascript, as well as shut down and rebooted a number of times, but everything is still highlighted in the bright, obnoxious blue instead of the softer, less jarring slate blue.

Any thoughts of things to try short of uninstalling and reinstalling Acrobat? (I'm using 8.1.2 Pro)

Donna
Runolfr
Registered: Oct 1 2008
Posts: 119
I remember asking this question myself not long ago. Maybe this thread needs to be a sticky?
Runolfr
Registered: Oct 1 2008
Posts: 119
dlettow wrote:
I used this code to turn field highlighting on in one document. Now that color (I used color.blue instead of color.yellow) is the highlighting color for every document I open. I've gone back to the original document and stripped out the Javascript, as well as shut down and rebooted a number of times, but everything is still highlighted in the bright, obnoxious blue instead of the softer, less jarring slate blue.Any thoughts of things to try short of uninstalling and reinstalling Acrobat? (I'm using 8.1.2 Pro)

Donna
There should be a scripting reference that you can download from Adobe that has property values for things like highlight color. You should be able to use that to set it to the color you want.
brian.deer
Registered: Oct 21 2008
Posts: 5
I opened a form with this code inserted:
app.runtimeHighlight = true;
app.runtimeHighlightColor = color.yellow;

and had the same issue. all of the documents opened after the code was entered had yellow highlights. Seems that this will cause your default highlighting in reader to change. If you go to edit , then preferences, under forms, you can change your Fields Highlight color back to what it was originally.

I removed the second line of code and only inserted :
app.runtimeHighlight = true;

and it worked fine to turn the highlighting on and didn't affect the default color.
dlettow
Registered: Jan 24 2008
Posts: 20
Whew! Thanks!

Donna
dtan
Registered: Feb 12 2009
Posts: 1
Hi,

we're displaying the PDF document via web browser. We would like to automatically set the higlight fields to TRUE when the form is loaded. We added the code:

app.runtimeHighlight = true;

to doc:ready, form:ready. initialize event but it doesnt work.

Any idea why ?

Also, we found out that if there is an existing PDF document that is opened using Adobe Reader, then above code will work. Seems that it is dependent on my Adobe reader installed in my local machine.

Any help will be appreciated.

Thanks.
Diana
lkassuba
ExpertTeam
Registered: Jun 28 2007
Posts: 3636
Try placing it on the Layout:Ready event instead. This may be a timing issue because the Initialize event occurs prior to the Layout:Ready event . Layout:Ready is supposed to occur once all fields have been laid-out (rendered) on the form.

Lori Kassuba is an AUC Expert and Community Manager for AcrobatUsers.com.

fchrisb
Registered: Dec 13 2010
Posts: 1
Hi Everyone,

Is there a way to "on focus" highlight the field? Or on focus change the fill color so people don't lose what field they are in?