Hello Richard,
You're in luck! becuase I wrote a "Contact Sheet" in InfoPath 2003 when I First Encountered this issue.
Unfourtunately, I haven't a clue how to write Jscript but I wrote it in Visual Basic Script which would be applicable with InfoPath 2003.
When the contact is selected, with the "Full Name" Pull Down it then Populates that users Email address and Phone Number.
Regardless of which row I changed it should always update the corresponding row (of course)
- First, Set your "Form Options" to use 'VB Script"
- Then create the Repeating Table Below:
- Respectively: Field1, Field2, Field3

- Then added a Data Connection that queries the contact information I need.
The Data Connection could be SQL or Sharepoint or whatever, but remember what you named the datasource. (mine was Called "Contacts" and it Queried a Sharepoint List.)
- Then add a "On After Change Event", by selecting the pull down and right-click - select it from the "Programming" menu
It should add the Following Sub to your project
BOLD: new Code to Write
Italic: my Comments
Sub msoxd_my_field1_OnAfterChange(eventObj)
Dim MyDataConnection
Set MyDataConnection = XDocument.DataObjects("Contacts").DOM
'This sets the reference to your Data Connection we made where "Contacts" is the name of your Data Connection
MyDataConnection.setProperty "SelectionNamespaces", "xmlns:dfs=""http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"" " & _
"xmlns:dsf=""http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"" "
'This enables us to call the additional nodes within our Data Connection
Dim CurrentContact
CurrentContact = eventObj.Site.selectSingleNode("../my:field1").text
'This is where we set the relative Xpath to the Current Row (if the Xpath was "my:fields/my:group1/my:field1" then it would always return the first row in the table)
Dim DataNode
DataNode = MyDataConnection.selectSingleNode("/dfs:myFields/dfs:dataFields/dsf:Contacts[@Full_Name='" & CurrentContact & "']")
'This Queries the Record in the DataConnection where Full_Name = Field1 (CurrentContact)
If (CurrentContact <> "") Then
'This is just in case the Field is Blank on "update" it won't return an error
If TypeName(DataNode.attributes.getNamedItem("E-mail_Address")) <> "Nothing" Then
'This is just in case the user doesn't have an email address the form won't return an error
eventObj.Site.selectSingleNode("../my:field2").text = DataNode.attributes.getNamedItem("E-mail_Address").text
'Thes sets Field2 (email address) to the address in the DataNode Query we created
End If
If TypeName(DataNode.attributes.getNamedItem("Business_Phone")) <> "Nothing" Then
'This is just in case the user doesn't have a phone number the form won't return an error
eventObj.Site.selectSingleNode("../my:field3").text = DataNode.attributes.getNamedItem("Business_Phone").text
'Thes sets Field3 (Phone Number) to the Phone Number in the DataNode Query we created
End If
End If
If eventObj.IsUndoRedo Then
' An undo or redo operation has occurred and the DOM is read-only.
Exit Sub
End If
'A field change has occurred and the DOM is writable. Write code here to respond to the changes.
End Sub
Hope this helps!
Kaleo