Search This Blog

Sunday, January 13, 2008

Infopath Web Form - Cascading dropdown in a Grid

In Infopath web forms, drop down cascading is not an out of box feature. Lot of posts have been made around for making that work. However to have a cascading dropdowns within a Grid on the web form, needs a little more work. Am putting the design on how this will work.
Scenerio: Each row of the grid has two drop downs i.e. Region and State. On selecting region the state drop down shows states correponding to the region selected in the same row. Here is a design for accomplishing this.

Given the Main data source with a following schema:

Main
ABC(Repeating Group bound to the Grid on the form)
RegionValue ( drop down value selected by Region drop down is stored in this)
StateDropDown (create a repeating Group here below ABC)
StateNameDropDownValue
StateNameDropDownDisplay


Now you need to have custom code to fill in the values for StateDropDown repeating group elements StateNameDropDownValue and StateNameDropDownDisplay thru "code"for in the given row.
Change the state Drop down to bind to the repeating group StateDropDown elements i.e. value to StateNameDropDownValue and Display Name to StateNameDropDownDisplay.

This fixes that issue however has one small disadvantage i.e.

The listitems for each state drop down will be stored along with InfoPath XML file so little more space is occupied in the persisted data.

Mo

No comments: