Expand my Community achievements bar.

Creating a dependent drop down box in an interactive form?

Avatar

Former Community Member
Hello -



I'm pretty new to Acrobat and not fluent with JS (I'm a chemist), so please forgive me if this seems a silly question:



I'd like to create a form wherein there are two drop down boxes and the choices seen in the second of the two are dependent upon the choice made in the first. An example of such might be a list of departments in the first field and a list of staff in the selected depertment in the second field.



I'm using Acrobat ver 7.0 (Pro) with Designer, by the way.



I've been able to do this in Excel through use of validation functions, but I'd like to get away from Excel if at all possible.



Thanks very much in advance!



Chris
1 Reply

Avatar

Former Community Member
To keep the department/cities sample; i'll try to explain you how i did it in Designer:

I created a "variable" bloc (at the bottom of the Hierarchy tab) called Cities

An other one called Departments

A last called CitiesFunctions



In the Cities bloc, i declared an array with all cities.

In the Department bloc, I declared an array by department. In each array, i have 2 items : the index of the first city of the department in the cities tab and the index of the last city of the department in the cities tab.



On my form, I created a dropDownList called Department (populated with departments) and an other called cities initialized empty.



On Department change event:

I rase the cities field.

I call my function getCitiesByDpt in my CitiesFunctions bloc with the department in parameter.

In these function I call the array corresponding to the department in the Cities bloc and I populate my listBox cities by the results (tab of cities from parameter 1 to parameter 2 of my Department array).

Carrefull : if a list has too much items, you should create a "manual list" composed of 1 textField, 1 button, 1 listBox (it's better for performance)



After than, always by script, you can restrict you second list by the sequence of characters eventualy keyed in the field Cities.



I hope i'm a little beat clear ! it's hard to explain in a forum (and sorry for my french english...:))



Pierre.