Skip Ribbon Commands
Skip to main content
www.iwkid.com > Blog > Posts > Cascading Drop-Downs in InfoPath
October 01
Cascading Drop-Downs in InfoPath

Here's a fun trick if you've ever wanted to have related/cascading drop-downs in InfoPath:

1) Create the data source for your drop-downs.  Here I am using an XML file:

image

2) Add your data source as a resource file:

image

image

3) Add a data connection for your resource:

image

image

image

image

4) Add your drop-downs to the form:

image

5) Configure the data source for your parent drop-down:

image

6)  Configure the related drop-down:

image 

This is where it gets tricky.  We need to add a pretty complex filter here.  First click on Filter Data:

image

Then add a filter:

image

Choose to select a field or group:

image

Change the data source to Main and select the parent field:

image

Then you'll have most of the filter defined:

image

Now switch to the expression view:

image

And update your expression:

image

In this instance we're saying that the title attribute of the parent state element should match what was selected in the parent drop-down.

7) To make sure the drop-downs work properly you'll want to clear the related field every time the parent field gets changed.  To do that, add a rule to the field:

image

Select Rules:

 image

Add the following rule with an action to set the related field's value = to ""

image

8) Test the form by selecting preview:

When I select MN I should get a list of just the MN cities:

image

After selecting a city:

image

When I change the state to WI, Bloomington is unselected:

image

And when I hit the city drop-down again, I should get a list of just the WI cities:

image

You can download my example XSN here.

Comments

Hi

Hi Raymond!!
really this is a nice article. but this is not supported for browser compatability..!! is there any way to do this for browser compatability!!!
 on 12/21/2008 10:44 PM

help with setting up cascading windows

I've followed your steps right up to completing the Data Connection Wizard, but when I click on Finish, I get an error saying: "InfoPath has encountered an error. The operations failed. Unspecified error"

How or what have I done wrong? I cannot proceed from this point.

Thanks for the help.
 on 3/17/2009 1:33 PM

help with setting up cascading windows

I've followed your steps right up to completing the Data Connection Wizard, but when I click on Finish, I get an error saying: "InfoPath has encountered an error. The operations failed. Unspecified error"

How or what have I done wrong? I cannot proceed from this point.

Thanks for the help.
 on 3/17/2009 3:58 PM

Browser Enabled

How can we achieve this functionality in browser enabled form
 on 4/14/2009 3:53 AM

Re: Cascading Drop-Downs in InfoPath

How can you do this for browser enabled forms? It will not let you filter.... :(
 on 10/27/2009 12:33 PM

Re: Cascading Drop-Downs in InfoPath

How can you do this for browser enabled forms? It will not let you filter.... :(
 on 10/27/2009 12:34 PM