Dynamic dropdown

  • 25 January 2016
  • 2 replies
  • 8 views

Badge

I am new to K2 and trying to design a form that has 2 dropdowns. I would like to control the options available in the second dropdown based on hte selection in the first drop down. Example

Dropdown 1

1.1 Item 1

1.2 Item 2

1.3 Item 3

 

Dropdown 2

1.1.1 Sub item 1 option 1

1.1.2 Sub item 1 option 2

1.1.3 Sub item 1 option 3

1.2.1 Sub item 2 option 1

1.2.2 Sub item 2 option 2

1.2.3 Sub item 2 option 3

 

So if I select 1.2 Item 2 from the first dropdown I will only get the sub items relevant to option 2 in the second dropdown.

 

thank you


2 replies

Userlevel 5
Badge +16

Hi,

 

The most important thing in your scenario is to have lookup table(s) or relation (association)

 

 

ID           Item                   ItemID

1         1.2  Item 1               1.2

2         1.1  Item1                1.1

 

ID       SubItem            ItemID(ParentItemID)

1       1.2.1 Item 2                    1.2

 

now you can add the following rule:

 

When MainItem drop down list is changed 

 

Populate SubItem drop down list(add filter here by passing the ItemID from the datasource of the MainItem drop down list)

 

Note: this can be achieved in many ways, it all depends on your data base design

 

Badge +5

Hi Izachur,

 

To build upon Mustafa's response with linking or associating SmartObjects, take a look at the following section from our SmartForms training course 200.YUL.

 

Configuring Cascading Drop-Down Lists in SmartForms

 

This will walk through the basics of setting it up, there is also a short video link at the top if you want to see it in action.

 

 

Jason

Reply