Hello, I am stumped and could use some help. I began researching an answer (both here and on the web) yesterday, and I'm still not even close, I'm afraid.
I created a form in InfoPath 2003 that uses a repeating section to enter customer data. It has a button at the bottom of the page. I've written some validation code that runs in the on-click event of the button.
The problem I'm having is that when the code in the on-click event runs, it only looks at the first instance of the repeating section. I'm trying to figure out how to loop through all the instances of the repeating section to have the validation code check each instance. I believe I need to use SelectNodes, but I can't figure out where to go with it.
My data structure looks like:
myFields
- dataFields
-- d:Requests
--- Customers <-- this is where the data for the repeating section is.
Any help would be greatly appreciated!
ETA: I tried the code below (trying to figure out what's what). After I submitted a form with 2 instances of the repeating section, objXMLNodes.count was still equal to 1. Am I going about this the wrong way?
Set objXMLNode = XDocument.DOM.selectSingleNode("//dfs:dataFields/d:Requests/d:Customers")
XDocument.View.SelectNodes(objXMLNode)
Set objXMLNodes = XDocument.View.GetSelectedNodes
If (objXMLNodes.Count > 0) then
XDocument.UI.Alert(objXMLNodes(0).nodeName + "\n\n" + objXMLNodes(0).text)
End if