Change Reference Field Background Color

Brent L_3
Kilo Contributor

I am trying to set the background color on a reference field. I am able to set the color of other fields but just not reference fields.

Here is what I using to set other fields.

I am doing this via a client script.

var cff = g_form.getControl(fieldname);

cff.style.backgroundColor = 'lightgreen';

 

Any help would be appreciated.

7 REPLIES 7

Prateek kumar
Mega Sage

Ian Mildon
Tera Guru

As vkachineni mentioned, Field Styles are another, simpler, option.

Right click the field label, select Configure Styles. Create a New Style and in the Style field enter:

background-color: lightgreen

mctroff
Giga Contributor

The problem here is the getControl() method doesn't work for reference fields.

Use getDisplayBox instead...

g_form.getDisplayBox('reference_field').style.backgroundColor = 'green'

 

See here for this information on Now Support:

Unable to change background color of reference field using g_form.getControl in client script - Supp...