InfoPath form Cascade dropdown 



use Case:

Create a cascade drop down for list of countries and states. If I select one country from first drop down second one should display corresponding states only not all the states

Step 1:

Create two lists

1) List of countries.

2) List of states associated with countries.

Step 2:

Create data connections for both the lists.

If you want to know how to create data connection please check the previous article here on create data connections.

I created country_dc, states_dc  (data connection names).

Step 3:

Associate data connections to drop-down lists in Info-path form. (associating country_dc to country drop-down and states_dc to states drop-down).

Step a: Right click on country drop-down -->drop-down box properties --> select get choices from external data source.

Step b: From data source drop down select newly created data connection (i.e. country_dc).

Step c:  Please select the value option by clicking option beside the text box (value means which value you want to store internally either Indexed id or actual name).

Step 5:

Similarly select the display name also (display name usually everyone selects actual column value here it is countries).

Repeated same procedure for sates drop down also to populate values. Now we just associated drop downs with data connections.

Country drop-down is loaded with all available countries.

States drop-down also loaded with all available sates irrespective to selected country.

Step 6:

Here is the key step we need to do i.e. ( filtering states based on country selection ).

Step a: Go to states drop-down list box properties select entries X-path.

 

Step b: Click on filter data button.

Step c: Click on add button to add a new rule to filter data.

From the first drop-down select country.

Select equals to operator from middle drop-down as well as select field or group form right drop-down.

Select main data connection from the displayed pop up window.

Select country data field from main data connection.

Now we prepared the condition successfully it looks like as shown below.

Click on OK and apply the changes.

Result:

Conclusion:

In this article you have learned how to create cascade drop-down in InfoPath forms.

Problem:

Once selecting the country and state on the form, when I try to change the selection for the country, normally i should see new selection of states for the corresponding new country selection.

The problem is it is still showing me previously selected state with the new choices for states of changed country. 

Please check next article for the solution here.



Join 6,500 subscribers and receive instant access to

Devendra's Library of Resources for SharePoint Developers


About Author

Venkat working as an Office 365 and SharePoint consultant. Venkat likes to share Office 365 and SharePoint knowledge through (Videos, Discussions, Tutorials and Blogs).

About Author

Devendra Velegandla is a four-time recipient of Microsoft's Most Valuable Professional (MVP) award (2014-2017) for Office Servers and Services MVP and  SharePoint Server. He received the MCC award for his contributions in Microsoft MSDN/TechNet forums. He loves sharing articles, videos, and tutorial on SharePoint and Office 365.