Expand my Community achievements bar.

Multiple drop down lists

Avatar

Level 2

Hi!

I need help with a form I am creating. I have 6 drop-down fields next to each other on my form. What I want to do is have a parent-child relationship through thte 6 drop-down fields.

For example, in the first drop-down field, the selections are "vegetables" and "fruits". Depending on which is selected, the next drop-down next to it will populate with "colors of the item" (Fruits --> Red, Orange, Yellow, Green). Then when the color is selected, the next drop-down will populate with items that has that color (Fruits --> Red --> Apple, Strawberry, Cherry).

Can this be accomplished with out using a database? If so, how? Please help!

Thanks!

3 Replies

Avatar

Level 10

Hi,

Yes, you can, by hardwiring the dropdowns. You would use the preOpen event of a child dropdown, that looks back at the value of the parent. Then it populates its list based on that value.

Here is an example where the dropdown looks at the value of three checkboxes. the script should give you a direction:

https://acrobat.com/#d=cS2B8Nj17CFbw1D9-BAnQA

Hope that helps,

Niall

Avatar

Level 2

The example helped me with the first two drop downs, but not the third. Once the first drop down is selected, the second drop down gets populated because of the "item values" assigned to the first column items under the Binding tab. So how do i applied the same code to the third column, and how do I assign values?

----- form1.#subform[0].thing::exit: - (JavaScript, client) ----------------------------------------

// clear the current selection in the department dropdown

attribute.rawValue

= null;

attribute.execEvent("exit");

----- form1.#subform[0].attribute::exit: - (JavaScript, client) ------------------------------------

if

(this.rawValue == null)

{

this.rawValue

= "Please select from this list.";

}

----- form1.#subform[0].attribute::preOpen: - (JavaScript, client) ---------------------------------

// clear the list

this.clearItems();

 

// repopulate the items based on the previous drop down list

if

(thing.rawValue == '1')

{

this.addItem("green");

this.addItem("white");

this.addItem("blue");

this.addItem("purple");

}

else

if(thing.rawValue == 2)

{

this.addItem("banana");

this.addItem("apple");

this.addItem("pear");

this.addItem("orange");

}

----- form1.#subform[0].attribute::docReady - (JavaScript, client) ---------------------------------

if

(this.rawValue == null)

{

this.rawValue

= "Please select from the list.";

}

Avatar

Level 10

Hi,

What determines the display items of the third column (dropdown)? Is it from the selected item in the first column or the second column, or some other field?

It might be easier if you could share your form or the part that is giving you trouble. Can you upload it to a file sharing site, like acrobat.com and post the published link here?

Niall

Assure Dynamics