Expand my Community achievements bar.

SOLVED

Change background color on a Drop down list based on the value

Avatar

Former Community Member

Hello,

I'm new on the LiveCycle designer and I need a little help.

I try to make a drop-down list with 3 options (lets say January, Februray and March). When I'll chose one of this options I want the background to change automatically (lets say for January in yellow, for February in red and for March in blue).

Your help will be much appreciated,

Adrian

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Adrian,

I suspect that the form is not set to automatically save script changes. If you go to the File > Form Properties > Defaults tab and select Automatic from the radio buttons:

Parallels Desktop1.png

That seems to work here.

Niall

View solution in original post

14 Replies

Avatar

Level 10

Hi,

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

See example here: https://acrobat.com/#d=WzvhgBC6FEwnr5DgSgVdlA

Good luck,

Niall

Avatar

Former Community Member

Hi,

I'm back again with another issue.

The form that I'm working actually is a performance review. After is filled out with all the comments, from that drop down list that I've created (and I asked about color change) the reviewer chose the ranking evaluation (from Excellent to Unsatisfactory) each of them having a different background color.

This is WORK PERFECT

Now the problem is when the form is signed. After the signature is applied, the color disappeared....become white (blank)....the script seams to be disabled

Anyone have an ideea....

Thank you in advance,

Adrian,

Avatar

Correct answer by
Level 10

Hi Adrian,

I suspect that the form is not set to automatically save script changes. If you go to the File > Form Properties > Defaults tab and select Automatic from the radio buttons:

Parallels Desktop1.png

That seems to work here.

Niall

Avatar

Former Community Member

Dear sir,

I am having the problem to change the color of dropdown list according to its content.

Like in your case changing background colour for "January", "February".

I am a beginner so, could you please send me a small form just containing this dropdown list.

Thanks in advance

my email address

nischalta@hotmail.com

Avatar

Level 10

Hi,

There is a sample here: https://acrobat.com/#d=WzvhgBC6FEwnr5DgSgVdlA

If you open it in LC Designer, you will see the structure of the form and script.

This screenshot is just to make sure you have the environment set up so that you can see the important parts:

  • Hierarchy on the left;
  • Script window on the top.

Here you can insert and amend script to make the form functional:

Parallels Desktop1.png

I hope that helps,

Niall

Avatar

Level 1

Hi,

I am creating a form in LiveCycle and I edited the Javascript exactly how it was shown on this form but for some reasons my changes will not apply to the form.

Is there a more detailed explination of how exactly to set the values?

Avatar

Level 10

Hi,

Make sure the form is saved as a Dynamic XML Form in the Save-as dialog.

LC SaveAs Dialog.png

Hope that helps,

Niall

Avatar

Level 1

For some reason I cannot see the "Adobe Dynamic XML form" in the save as drop down menu.  I am using Live Cycle Designer 8.0.  I do not see an option in the form properties default tab to select a target version.  Is it possible to do so with my version of LiveCycle??

Avatar

Former Community Member

This may happen in the following scenarios:

1. Make sure that you use the full licensed version of LC Designer and supportive versions of adobe reader.

2. Re-install the LC Designer without any errors.

You have the chances to miss this option if it partially meets the above criteria.

Avatar

Level 10

Hi,

Also, if you have created the form by importing an original Word or PDF document into LC Designer, then depending on the choices you made, you may not be able to save the form as a Dynamic XML Form.

Niall

Avatar

Level 1

Okay I created my form in indesign and I discovered that I have to create the interactive form with the flowable layout. I have some header images that do not appear correctly and I was wonder if there was a way to change the opacity of an image in LC.  The image in question has a blank background and when converted to a form with a flowable layout the image has a white background instead. What are the options for exporting from indesign that might alieviate this problem? or are there any solutions within LC that will help?

Thanks for being so helpful Niall

Matt

Avatar

Level 10

Hi Matt,

The short answer is that you can't use an InDesign layout for a dynamic LC Designer form, with a flowed layout.

There are a couple of options for using an InDesign > PDF > LC Designer workflow, however these are restricted to static layouts or just bear minimum backgrounds.

For example, for some projects I prepare an A4 background in Illustrator and then export this to .png. In LC Designer I use an Image object on the Master Page to display this .png. However in this situation the .png has header and footer elements that don't relate to input areas on the form. I then use objects in LC Designer to create either the static or dynamic form.

So in your case you may need to alter your InDesign file, to only include background/header/footer elements and NOT input areas. Then export to an image format. I find .png to be a small file size, but you may want to push it up to 300px as it may be fuzzy at lower resolutions. Then in LC Designer go to the Master Page and drag an Image object onto the page. Set its position to 0,0 and the width and height to the page size. Then associate this with your .png file from InDesign. Adjust the Content Area (purple dotted line) to constrain the pages to suit your InDesign layout. See here: http://assure.ly/g0Wx7r.

From there you would use objects to create the main form on the Design Pages.

Hope that helps,

Niall