Expand my Community achievements bar.

Dropdowns based on previous selection and auto populate

Avatar

Level 5

Good day All;

With any luck, this will be the final touches I will need to get this form ready for approval.

Anyway…. This is what I am trying to do. When using dropdown lists, I would like to be able to select from a group of managers depending on what “Section” was selected. It gets a little more crazy (to me anyway).

Example: There a 3 divisions with 1 director per division.

                 Each division has 4 or more sections with a manager for each section.

So that being said, what I would like the user to be able to do is:

If user selects Division “1” the “director” field will auto populate with “Director 1” name.

Next, when the user selects a “Section” from the dropdown, they will only be presented with a list of sections that belong to “Director 1”. When they make the selection, the “manager” is auto populated with the manager’s name…….

Please let me know if I have gone a wee bit over the deep end with this.

I hope this made sense??? ;>))

Thanks All

Chomp

3 Replies

Avatar

Level 10

Hi Chomp,

This is relatively straightforward to achieve.

The main script would be in the preOpen events of the dropdowns, where it would look back at the previous selection and then addItems() with the appropriate information.

There is an example here: http://assure.ly/jcTahK. Also one here for accessing the display and bound values of a dropdown: http://assure.ly/fYCuQ2. Lastly how you can use the bound and display values with global binding: http://assure.ly/jtTkdO.

Hope this helps,

Niall

Avatar

Level 5

Hi,

I think I get what you want and there are two approaches that you could take,

Option 1 - if the options on the list are not going to change that often you could just hide and show the section drops downs based on the selection made to the directors dropdown

Always show "DirectorsDropDown"

Hide Division1DropDown

Hide Division2DropDown

Hide Division3DropDown

And then based on the selection of DirectorsDropDown populate the Directors name and show the correct DivisionDropDown.

Option 2 - is to auto populate the second drop down based on the first drop down

to do this you could use the "addItem" and "deleteItem" to remove all the items in the list and replace them.

I hope that option is pretty self explanatory ( but let us know if you need more )

Point to note :- in PDF forms the selection of the drop down list does not normally change until the dropdown list loses focus.

The workaround to this is to use "xfa.event.newText"

Hoep this helps

Malcolm

Avatar

Level 5

Thanks both. I have been thrown a wee bit of a curve ball as the powers that be woul

d like to rethink what this form will be used for.

Thanks Again

Don