Sun, Apr 2 2006 12:16
How to create a filtered drop down list in InfoPath
This is a question I have seen come up on the newsgroups a couple of times now so I figured it may be worth putting up a post to illustrate how to do this.
The basic principal is pretty simple the values in one combo box are determined based on a selection from a previous combo box
The first combo box will contain a list of authors, the second will contain a list of books written by the author selected in the first combo box
So now we know what we are trying to achieve it's time to look at how we actually do it. In this example both the Author and Book data is being sourced from the forms XML structure, there is however no reason why this data could not come from a web service, database or external xml file.
So our first step is to map our the list of Authors in our form to our first Combo box
The second step is to map data to our second combo box with a filter based on the value selected in the first combo box
once the data that is being displayed has been selected we then need to create a filter to make sure that only the books that were written by the selected author are displayed. To begin click the "Filter" button then click the Add button to add a new filter rule
This filter rule states that only the books that have the same Author as was selected in the "AuthorSelected" combo (Combo1) will be displayed.
This approach is a good way to ensure that the user selects only a valid combination of values when entering data. There is also no reason why this approach could not be cascaded more than once to create a more detailed hirearchy e.g. Year>Author>Book.