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

Changing dropdown fill colour on selection.

Avatar

Level 2

I am using Livecycle ES3. I have a script that is changing the fill colour dependent on what is selected in the dropdown. This is working fine for me in Acrobat X Pro but doesn't seem to work in earlier versions.

Is there something else I can do that it works in all versions, the form is saved to be compatible to version 7 and my target version is set to version 9.0 or later.

This is my script on the 'exit' event (thank you Assure Dynamics):

var vName = this.somExpression;

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

if (this.rawValue == "Ahead of Schedule") {

    fieldObj.value = "51,102,255";

}

else if (this.rawValue == "Progressing Well") {

    fieldObj.value = "0,196,0";

}

else if (this.rawValue == "Requires Attention") {

    fieldObj.value = "255,255,0";

}

else if (this.rawValue == "Requires Immediate Attention") {

    fieldObj.value = "255,0,0";

    }

else {

    fieldObj.value = "255,255,255";

}

Thanks for any help out there.

7 Replies

Avatar

Level 5

Hi,

you have to do the following:

Use the change-event, xfa.event.newText instead of this.rawValue..and it works fine.

ddl.jpg

You can use the following script:

switch(xfa.event.newText)

{

    case "example1":

    xfa.resolveNode("DropdownListe1.ui.#choiceList.border.fill.color").value = "0,255,0";

    break;

    case "example2":

    xfa.resolveNode("DropdownListe1.ui.#choiceList.border.fill.color").value = "12,45,133";

    break;

    case "example3":

    xfa.resolveNode("DropdownListe1.ui.#choiceList.border.fill.color").value = "134,255,0";

    break;

}

// OR YOUR SHORTER ONE

var vName = this.somExpression;

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

switch(xfa.event.newText)

{

    case "example1":

    fieldObj.value = "0,255,0";

    break;

    case "example2":

    fieldObj.value = "12,45,133";

    break;

    case "example3":

    fieldObj.value = "134,255,0";

    break;

}

Hope it will helps you,

Mandy

Avatar

Level 2

Thanks very much for your reply. I tried this method and my results were varied. The fill colour didn't always change.

The script I used worked perfectly fine, it just won't work correctly in versions prior to Acrobat X. Many of the people I work with are still using Acrobat 9 either Pro or Standard and it is not working well for them. Sometimes it only changes the colour when the field is clicked in and sometimes not at all.

Is there anything I can do about this?

Avatar

Level 5

Yes, you have to set the follwoing parameter.

  1. Got to File
  2. Form Properties
  3. Defaults
  4. Choose Target Version
  5. Select your choice

default.jpg

This is the screenshot for ES 3.

And below the screenshot for ES2 (in german , Standard = Default; Zielversion = Target version)

default8.jpg

Then take a look by "windows" | "info" and "report". If you got some error messages there it could be that some methods not supported by an earliere version. If you don't got a error message everythin should works fine.

Sorry for my english. I hope you understand me.

Kind regards Mandy

Avatar

Level 2

My form is set for target version 9.0 and later and the compatibility is set to version 7

defaults.png

compatible.png

I think I am going to change tactics and use show/hide a field instead.

I do appreciate your help and certainly, if you have any other suggestions I would really like to know.

Thanks,

Avatar

Level 5

"Info" and "reports" shows no error messages. It have o work correct.

Maybe this script is ok but another script in your form is not compatible and produce the error?

You could upload your form anywhere?

Then I can take a look.

Mandy

Avatar

Level 2

The form doesn't have any other scripts actually except for one simple show/hide based on a radio button selection.

I would be happy to share the form anyway but am not sure where to upload it?!

Avatar

Level 5

You could register yourself by Adobe Workspaces. https://workspaces.acrobat.com/app.html#o for free.

There you can upload your form.

Kind regards Mandy