Using the Filter Feature in InfoPath web forms
There is a great feature in infopath - Filter. Unfortunately this Feature is not available in Web Forms. Here ia a way to simulate this functionality.
1. The first step is to create a new form in infopath and add 2 Data Connection.
2. The First Connection to the Parent Lists
Tools--Data Connections--Add--Receive Data--SharePoint library or list--Select "Parent Library"---click next until the wizard finishes
3. The Second Connection to the Child Lists. with one difference in the configuration:
Tools--Data Connections--Add--Receive Data - XML -- in the Url type in
"http://server/_vti_bin/owssvr.dll?Cmd=Display&List={put the GUID of the Child Lists here}&XMLDATA=TRUE"
4. Add 2 Fields on the Form for the Parent and the Child DataConenction
5. Add the 2 fields as a DropDown Lists on the Form
6. Change the mappings for each Dropdown to the new Data Conenctions.
7. Now we must add some code on the Change Event of the Parent dropdown to populate
public void parent_Changed(object sender, XmlEventArgs e) { SetChildOptions(); } private void SetChildOptions() { FileQueryConnection q = (FileQueryConnection)this.DataConnections["Child"]; q.FileLocation = q.FileLocation + "&FilterField1=Parent&FilterValue1=" + GetStateValue(); q.Execute(); } private string GetparentValue() { XPathNavigator nav = this.CreateNavigator(); string filterValue = (string)nav.SelectSingleNode("/my:myFields/my:parent", this.NamespaceManager).ValueAs(typeof(string)); return filterValue; }
8. Add a rule to the parent ddropdown to re-query a data connection and choose the Child Connection.