Expand my Community achievements bar.

Parent/Child Drop Down Lists

Avatar

Former Community Member
Trying to create drop down lists where whatever is selected from the parent drop down list will populate the child drop down list. For example, the parent drop down list has 52 states listed. Whatever state is chosen from this list will populate the child drop down with the cities of the chosen state.



I followed the array example in the sample Purchase Order dynamic form in Designer 7.0, but can only get two states to work. When I try to add more states, it doesn't work.
2 Replies

Avatar

Former Community Member
On the first drop down list, use a javascript on the change event with the following:<br /><br />if (this.rawValue != xfa.event.change)<br />{<br /> soScript.updateCities(this.parent.DropDownList2, this.boundItem(xfa.event.change));<br />}<br /><br />Then create a script object (on the same level - right click on the parent node in the hierarchy view and select "Insert Script Object") named soScript with the following <br /><br />var g_arrayCities = new Array(<br /> new Array("Anaheim", "Los Angeles", "San Francisco", "San Jose"),<br /> new Array("New York", "Buffalo")<br />);<br /><br />function updateCities(objDropDown, nIndex)<br />{<br /> var arrayStateCities = g_arrayCities[nIndex];<br /> objDropDown.rawValue = "";<br /> objDropDown.clearItems();<br /> for (var i=0; i<arrayStateCities.length; i++)<br /> {<br /> objDropDown.addItem(arrayStateCities[i]);<br /> }<br />}<br /><br />Note: for the first drop down, I have set the "Specify Data Values" on the Binding Tab to attach an index to each State starting at 0.

Avatar

Former Community Member
Nikki,



How did your problem with your attachment go. Did you use ARES.