Cascading multi-select list boxes with validation in InfoPath 2013

In this InfoPath video you'll see how you can create cascading multiple-selection list boxes with data validation to detect whether selected child items are missing selected parent items.

In recipe 78, you'll learn how to create cascading multiple-selection list boxes with a check on whether selected items in the second mult-select list box are missing selected parent items in the first multi-select list box.

Get more solutions from InfoPath 2013 Cookbook 2 which is available on Amazon.com
OR
Watch next video: Bulk export selected InfoPath forms to Word documents

InfoPath demo video transcript:

Here I'm in SharePoint 2013, where I've got this SoftwareCategories SharePoint list that contains these 3 software categories. I also have this SoftwareProducts SharePoint list that currently contains these 4 items, that are linked to categories in the SoftwareCategories SharePoint list. So basically I've got two linked lists.

I've also already published an InfoPath form template to this SharePoint form library, and the basic idea now is that I would like to use those SharePoint linked lists to populate two multiple-selection list box controls on the InfoPath form, and then when I select an item in the first multiple-selection list box, I want its corresponding items to appear in the second multiple-selection list box.

The problem with this solution is that when I deselect an item from the first multiple-selection list box, you'll see that an orphaned item will be left behind in the second multiple-selection list box. Currently there are no rules in InfoPath you can use to delete items from a multiple-selection list box control, so you would have to write code to provide such functionality.

And because this InfoPath form is a codeless InfoPath form, what I've done instead is add data validation to detect whether there are any orphaned items in the second multiple-selection list box that are missing parent items in the first multiple-selection list box. And if that is the case, you'll see that this validation error will appear saying "One or more products are missing a selected category. Please deselect those products before continuing."

So I cannot continue. If I click Submit here, you'll see that I'll get this validation error appearing saying that I cannot submit the form. I can still go ahead and save the form if I wanted to.

Basically what the user would have to do now is, the user would either have to select the parent in the first multiple-selection list box to have the validation error disappear, or deselect the item that doesn't have a parent in the first multiple-selection list box so that the validation error disappears, and the user can then successfully submit the InfoPath form.

Related InfoPath Demo Videos:

Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent of S.Y.M. Wong-A-Ton. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author, S.Y.M. Wong-A-Ton.

 
InfoPath 2013 Cookbook 2: 121 Codeless Recipes for SharePoint 2013