Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Scripting Background color for DDlist selections


Level 1


I'm working on a form and am attempting to script a change in background color. I've done some scripting before, but I'm a fairly new user of LiveCycle Designer.

I have a drop-down list in my form.  The selections made in the drop-down form correspond to a list of procedures for that selection - I have each of these "check lists" bordered by a rectangle object type.

I would like to make it so that when a certain selection is made, the corresponding rectangle object changes it's fill color to gray (RGB 153,153,153), so that the procedures are easily identified.

I've read several forum listings for similar procedures, but I must be missing something in my script - because it's not working.

A better example of what I'm trying to do:

When I choose "Duplicate Payment" from the "Remediation Reason" drop down list, I want the corresponding rectangle (Object name "DupPmt") to change color to gray, so it appears that the entire list of procedures for "Duplicate Payments" is shaded.

I would like this change for each of the different choices in the drop down list.

I attempted to post alink to a sample of my form, but I'm unable to log in to (it keeps giving me an unexpected error after I log in).

Can anyone help me with this, please?


0 Replies


Level 10


The script you are looking for is:

Rectangle1.value.rectangle.fill.color.value = "153,153,153";

Alternatively you can change the presence of the fill (which would be set to the grey at design time):

Rectangle.value.rectangle.fill.presence = "visible";

There are some examples here: for instance "Laying out form objects", that might give you some direction.

Hope that helps,



Level 1

Niall - thank you for your help.

I'm still in need of help, as I haven't quite got it figured out yet.

I reviewed another forum posting of yours that gave a user a more complete scripting, and I hope that you can do the same for me.

That posting was as follows:

You can change the background colour at runtime with this script in the exit event:

var vName = this.somExpression;
var fieldObj = xfa.resolveNode(vName + ".ui.#choiceList.border.fill.color");

if (this.rawValue == "January") {
     fieldObj.value = "255,255,225";
else if (this.rawValue == "February") {
     fieldObj.value = "255,225,225";
else if (this.rawValue == "March") {
     fieldObj.value = "225,225,255";
else {
     fieldObj.value = "255,255,255";

/* Check the type of object and change the .ui reference:

     Date field =      #dateTimeEdit 
     Dropdown =      #choiceList 
     Checkbox =      #checkButton 
     Text field =      #textEdit 
     Numeric field =     #numericEdit

I think this is similar to what I want - except that I want to run it on a change event and I'm trying to make a selection in the drop down list object that will change the color in the rectangle object.

Here's what I have, but it didn't work when I previewed it:


event activity="change" name="event__change">


script contentType="application/x-javascript">if (this.rawValue == "Duplicate Payment")

{Rectangle1.value.rectangle.fill.color.value = "153,153,153"; }





I'm at a pretty low beginner level for javascript, so I'd appreciate if anyone can give me a more complete example.