Set Field's Content Fill Color

Beachbum2015 27-08-2015

I have a few text fields that I want to set the background, or fill color to a different color when the form opens.  I want these fields (not the captions) to stand out from the others, rather than making them required fields.

I tried this method with JavaScript in the field's initialize event, but the field only changes color when you enter the field.

Subform_Employee_Info.Table1.Row1.Name.ui.oneOfChild.border.fill.color.value = "0,200,0"; // green

I want the new fill color to show when the form opens.

How would I go about accomplishing this, and at the same time, making sure that the field color does not print?


(Using ES4)

Mark Solution

Are these answers useful?
Help other community members by marking useful answers as accepted.

Accepted Solutions (0)

Answers (25)

Answers (25)

Beachbum2015 14-09-2015


The problem with this solution is that it will turn off field highlighting for ALL fields.  It may help with the fields I want to color, but all of the other fields will be white, confusing the user.

Also, turning off highlighting with my form will leave the user with this feature disabled.  I wouldn't want to mess with someone's environment and risk ticking them off.  I don't want to rely on them knowing how to re-enable highlighting.


Ahh never thought of the highlighting , nice thinking...

Now that the problem has been found you can use other methods to help you do exactly as you want

If you want to make sure the highlighting fields is off, you can just use this line of code

XIIIX-inTVbY 13-09-2015

there's always a way -- i think i stumbled across a solution (a 'workaround' really) -- it's late here so i'll attempt the solution tomorrow..

fingers crossed

Beachbum2015 13-09-2015 does work...BUT, as you mentioned, there's no way to ensure that users will disable Highlight Fields.

Unfortunately, I can't use the solution.  It has to work without requiring the users to modify any settings.  They must be able to open the document and have it work without having to do anything else.

Oh well, I guess this one's going to have to go under the "Not Possible" column.

XIIIX-inTVbY 13-09-2015

OK >> I solved it... SOLVED!!!!!

The video indicates that you have HIGHLIGHT Fields setting active in Adobe Acrobat Pro/Reader - if you switch this off you will get the behaviour you expect. I'm not sure you will be in love with this solution (as it is difficult to ensure other users will switch off this setting) but -- staying on topic -- if you test my form again after switching HIGHLIGHT Fields off in Adobe Acrobat Pro/Reader it should perform exactly as you intend (assuming I've finally interpreted your intentions correctly).

does it work now... YAYYYYY!


Hi again,

Very sorry for this tiny error, instead of inserting the fill node in the /ui/textEdit node,

it must be inserted in the /ui/textEdit/border node

So this is where you should add it

Afterwards LiveCycle change it, that's why I thought it had to be in the textEdit node

Hope it will work!

Beachbum2015 12-09-2015


That's the code I mentioned in my original post.  But, you're getting close....

I opened your modified form in Reader, and the field's value color changes now, but only after you click in the field.  Once you leave the field, the value color reverts back to the default.

The goal is to have the value's color changed when the form opens, and have it stay that color.  The user should not have to click in the field to get the color to change.

Here's a video of what is happening.

XIIIX-inTVbY 12-09-2015

Using your form >> I've put the "correct" code in the field and it works fine for me. No need to mess with the XML source.


Screenshot 2015-09-12 15.27.51.png


Screenshot 2015-09-12 15.28.40.png

I'll post the form back here for you to use >> all the best..

Beachbum2015 11-09-2015

Hi Magus069,

Thanks for your input.  Unfortunately, no luck with the suggestion.

I created a new form with just one text field and applied your suggested code to the XML for the field.  No color change.

Here's the form that I created as a test:

Here's the field's XML:  (The addition is in bold)

          <field name="TextField1" y="6.35mm" w="92.075mm" h="9.525mm">




                     <edge stroke="lowered"/>



                     <color value="0,200,0"/>





            <font typeface="Myriad Pro"/>

            <margin topInset="1mm" bottomInset="1mm" leftInset="1mm" rightInset="1mm"/>

            <para vAlign="middle" widows="2" orphans="2"/>

            <caption reserve="11.8039mm">

               <para vAlign="middle"/>







Hi there,

So seems like Reader doesn't want to make it work, whatever what options is done it wont make it work..

But I don't know what is your intentions exactly, if you want to make it green only when it is opened at once, you can set the content's color to green by default within LiveCycle instead of setting it with JavaScript.

To do this, you must edit the XML source of the TextField.

So instead of using the LiveCycle UI to edit the color of your object, go in XML Source,

Look for the entire node of your field Name, then look for the "textEdit"  node and insert these lines of code inside it

So it should look something like this...

This will premanently set the content's field to green in your form, but you can change it if whenever the field's value is changed or anything like this.

Hope this will help ya!

Beachbum2015 11-09-2015


I had tried your suggestion before, but it colors the whole field green, instead of just the value (content) area.  I don't want to change the color of the caption, just the value. 

Here's the result of your suggestion:


XIIIX-inTVbY 09-09-2015

my guess is that the error relates to incorrent SOM path referencing.

try this..

script to be placed in target field ('Name') on the [initilize] event

this.fillColor = "0,200,0"; // green

Beachbum2015 31-08-2015

Well, it appears to be pretty straight forward. doesn't work.

Here's a sample form I just made using the code from Cameron's article to change the color of the Content Extent fill.  The code was placed in the Name field's initialize event.  Also tried in the form's initialize and docReady events.

Give it a try for yourself to see what I am talking about.  Do you have any suggestions??

Beachbum2015 31-08-2015

I tried using the docReady event, but get the same results.  The field color is light blue when the form opens, but only changes to green once you click on the field.

Beachbum2015 31-08-2015

OK, but how do I change the color of the field when the form opens.  That's the part that is not working.  Please see the original post.