Create dependent drop-down / list-box in InfoPath using filters


Suppose you want to have the items listed in a drop-down be dependent on the selection of another drop-down (this is also known as "cascading dropdowns). If you have InfoPath Service Pack 1 installed, you could use the "Filter Data..." feature to accomplish this.


Picture of two drop downs - state and city. 

You have one drop down labeled "State:" with the names of states and another drop-down labeled "City:" which gets populated with the names of the cities for the state you selected on the previous drop down.

The city drop-down obtains its values from an xml file which might look something like this:

  <City state="Washington">Redmond</City>
  <City state="Washington">Seattle</City>
  <City state="California">Los Angeles</City>
<City state="Florida">Orlando</City>


  1. In design mode, right click on the "City" drop down and open the Drop-down Properties dialog.

  2. Select to Look up values in a data connection to a database, Web Service, file, Share Point library or list.

  3. Click Add and follow the wizard to add the xml file containing the city data.

  4. After completing Data Connection Wizard, in the Entries field- select the source for the drop-down values by clicking the button on the right of the field. The Select a Field or Group dialog will appear, for this case you will select the "City" repeating group.

  5. Create a Filter by clicking the Filter Data... button and clicking Add... in the Filter Data dialog.

  6. You will want to create a Filter that displays the data in which the "state" attribute is equal to the field corresponding to the "State:" drop-down (Remember that the field value is kept in the form's "Main" data source)  

 Additional Notes/Tips  

  • Previous City selection will persist after changing state. You’ll need to set a Rule to change cities to empty after a change is made to states to avoid selected city remaining in City drop down. (Right click the "State" drop-down in design mode and open the Propeties dialog, click the Rules button and create an Action to set the "City" field value to empty, no condition is necessary since this rule will apply when a change is made). 

  • Instead of using drop-down controls you could also use list boxes. 

  • You could also use Conditional Formatting to disable the "City:" drop-down until a state is selected. 

  • If you'd like to implement dependent dropdowns in a browser-enabled form template, take a look at this article.

Comments (16)

  1. Anonymous says:

    Is there a way to accomplish this without SP1?

  2. Anonymous says:

    I battled bravely with this for a while before cracking it with a secondary data source I created from an access database but when I tried to hook it up to the SQL server I lost the dependent dropdown values.

    The connection works fine with both dropdowns populated with the full lists until I try to build the filter, then the dependent dropdown drops out.

    Any ideas



  3. Anonymous says:

    From Lauraj’s blog, I just read that the Infopath team has a blog. Great news. I didn’t realize but then again I haven’t been doing much blog related reading (or writing for that matter) for the past couple of weeks so I think it’s time to catch up. Today’s post is on one of my fave new things from the SP1 preview. Using filters on your dropdown boxes and secondary data sources….

  4. Anonymous says:

    To do this without SP1: lets say you have a query for the data adapter that you want to update based on the selection of another drop-down. What you want to do is write script such that on the change of the primary drop down, you update the query for the adapter you want to refill itself and then requery that adapter.

  5. Anonymous says:

    I have a dependent drop-downs/list-box in InfoPath using Filters working in a repeating table for the first row; however, the subsequent rows contain any previously filtered data.

    I am sure there is a simple way to fix it. I am just over looking it.

  6. Anonymous says:

    I also have the above problem.

  7. infopath1 says:

    For the two above comments: in InfoPath 2003, you need to employ an XPath current() function, described in this article:

    InfoPath 2007 will do this for you.


    • Alex
  8. namariegaudi says:

    I have created an InfoPath form and have a specific field linked to another site via a data connection from where I collect a set of alphanumerical codes (ex: WTR001A, GDL542B). I want to semi filter the codes. I don’t want to sort them alphabetically for now, just worry about filtering the options upon selection of a specific building location.

    My 1st filter field asks the user to select a building location which are:

    • AMS = Americas

    • BA = Buenos Aires

    • BCN = Barcelona

    • Etc.

    Upon the user’s selection I want the “codes” mentioned above to display only the ones pertaining to that building location. Perhaps having a XML file that specifies if a user selects Barcelona, then only show BCNXXX “codes” if a user select Singapore, then only SGPXXX codes show

    Would an XML file work? If so how would it look like?

  9. Anonymous says:

    Thank you man that was a good article

  10. Anonymous says:

    how do I create the xml the city drop down obtain its values from?

  11. Anonymous says:

    I do this 'filter' and it returns only 1 row in the drop down, while it should return 4 or 5 different values in the dropdown.

    PS: using Infopath 2010.

  12. Anonymous says:

    I want to do something similar to this but using a check box to filter the 2nd drop list. Any help on how to make that happen?

  13. Anonymous says:

    If you are interested in learning advance use of drop down list with Conditional Formatting…/cascading-drop-down-list-using-conditional-formatting-in-microsoft-excel-2010.html

  14. Anonymous says:

    on the state property, if I add a rule to set City to empty, it does not change at all, the first few selected cities stays there forever.

  15. Anonymous says:

    Any way to get this to work from Excel?

  16. Robyn Farley says:

    Thank you, Thank you! Solved huge issue for me.

Skip to main content