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

Adobe LiveCycle Designer working with 2 drop down list, one response triggers the other

Avatar

Level 2

I am fairly new to Adobe LiveCycle Designer ES 8.2, but I would like to have a drop down list of managers and another drop down list of employees.

I would like this set up in such a way where the manager can click on their own name in the manager list and have a drop down list appear which is only populated with their directly reporting employees.  They can then click on the individual employee they are going to report on.

Then there will be several questions pertaining to the individual direct report, etc. (This part I can do)

Is this possible?

If so, please provide detailed instructions for me to try.

Thank you in advance.

7 Replies

Avatar

Level 8

Put this in the change event of your Manager drop down:

var myObj={"Manager 1":"Employee A,Employee B,Employee C",
                    "Manager 2":"Employee D,Employee E",
                    "Manager 3":"Employee F,Employee G, Employee H"};

DropDownList2.setItems(myObj[this.boundItem(xfa.event.newText)]);

This is assuming the list of items in that dropdown is "Manager 1", "Manager 2", "Manager 3".

And DropDownList2 is the name of your Employee drop down.

Kyle

Avatar

Level 2

Thank you for the response and excuse my ignorance, but where would this go?

I looked under the XML Source tab but can't see this anywhere.

Please advise.

Avatar

Level 8

1) Click on the DropDown object that has your list of managers

2) Go to the menu bar and click Window>Script Editor or press Ctrl-Shift-F5

3) In the script editor at the top left next to 'Show:' select 'change'

4) Select 'Language: JavaScript'

5) Paste your script

Kyle

Avatar

Level 2

I did a variation on this and it works well.

My question is.

What do I need to put in to make the 2nd value clear out if they change the first value?

As it is now they can still make a mistake by extra fiddling with the field.

var myObj={"PRD-ER":"1 μR/hr-PRD-ER,2 μR/hr-PRD-ER,3 μR/hr-PRD-ER,4 μR/hr-PRD-ER,5 μR/hr-PRD-ER,OUT OF RANGE-DESCRIBE/COMMENT",

                    "451P":"5 μR/hr-451P,6 μR/hr-451P,7 μR/hr-451P,8 μR/hr-451P,9 μR/hr-451P,10 μR/hr-451P,11 μR/hr-451P,12 μR/hr-451P,13 μR/hr-451P,14 μR/hr-451P,15 μR/hr-451P,OUT OF RANGE-DESCRIBE/COMMENT"};

DropDownList2.setItems(myObj[this.boundItem(xfa.event.newText)]);

Avatar

Level 1

dcidev,

Thanks for your code. I tried this myself, but after the Manager dropdown is selected, the only thing that I'm seeing in my DropDownList2 is the word "empty".  What am I doing wrong?

Btw, I placed the code in the change event of my Manager drop down.

Any assistance would be greatly appreciated.

Dan

Avatar

Level 8

Dan, I may have an idea of what's going on in your case:

1) Select your DropDownList2

2) In your Object palette, select the Binding tab

3) Make sure Specify Item Values is unchecked or

4) Make sure the item values are the same as those in myObj

Kyle

Avatar

Level 1

dcidev,

That was precisely the problem! It now works!! Thanks so much!

Dan