I am still struggling to get this implemented. Please help. I am using InfoPath 2007 and need to upload this browser enabled form in to SharePoint
First List Box:
This first list box lists all the items from Sharepoint list using web service. User will be selecting one or more item from this in to second list box.
1. I defined a data connection to receive data from SharePoint Web Service.
2. I inserted a repeating section and then I inserted a list box control on to that.
3. This list box is bound to non repeating field called AppListField in Main Data Source
4. In the properties of the list box I selected "look up values from an external data source" and selected the data connection I formed in step 1 above. I have selected Id for value field and App Name for Display Name.
5. Is it all okay?
Second List Box
1. I inserted a list box control in to a repeating section.
2. I created a repeating group in Main Data Source
3. The repeating section is bound to the repeating group
4. I created another non repeating field under repeating group and bound the second list box to that. Am I right in doing this way?
Click Event Code:
1. On click event of the button I am able to get the value of the selected item from first list box in to the variable
AppListField in MainDataSource. I donot know how to get the display name.
2. Once I get the value I am adding it to the XML file and it never shows there. I have given the code below.
XML File: Initially this XML will be empty as the user has not added anything.
<SelectedAppListGroups>
<SelectedAppListGroup><ImpactAppId/><ImpactAppname/></SelectedAppListGroup>
</SelectedAppListGroups>
Code on Button Click Event
XPathNavigator AppListField = DOM.SelectSingleNode("/my:myFields/my:AppListField", this.NamespaceManager); //getting selected item from first list box.
DataSource ds = DataSources["ImpactAppList"]; //XML file data source tied to second list box
XPathNavigator selectedAppList = ds.CreateNavigator();
XPathNavigator SelectedAppGroup = selectedAppList.SelectSingleNode("/SelectedAppListGroups/SelectedAppListGroup"); //
XPathNavigator ImpactAppIdNode = selectedAppList.SelectSingleNode("/SelectedAppListGroups/SelectedAppListGroup/ImpactAppId");
XPathNavigator ImpactAppnameNode = selectedAppList.SelectSingleNode("/SelectedAppListGroups/SelectedAppListGroup/ImpactAppname");
SelectedAppGroup.AppendChildElement("", "ImpactAppId", "", AppListField.Value);
SelectedAppGroup.AppendChildElement("", "ImpactAppname", "", "Test33"); //I am adding a dummy value because I am not able to access the display name from First List box
Thanks in advance.