I am having a problem with some code to set the value of some text boxes in a repeating table for the 2nd, 3rd, 4th, etc. rows. Each time I add a new row, it seems to be updating the 1st row only.
In the repeating table, I have the 1st column being a drop down. Once the user chooses an item, it goes and grabs the values from a database and populates the text boxes on that row.
I have some vbscript in the OnChanged event of the drop down, it looks as follows:
Dim doc
Set doc = XDocument.DataObjects("UV_Proposal_Process_Maint").DOM
doc.setProperty _
"SelectionNamespaces","xmlns:dfs=""http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"" " & _
"xmlns:dsf=""http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"" " & _
"xmlns:q=""http://schemas.microsoft.com/office/infopath/2003/ado/queryFields"" " & _
"xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-02-02T17:26:37"" " & _
"xmlns:d=""http://schemas.microsoft.com/office/infopath/2003/ado/dataFields"" "
selectedProcess=""
if isnull(eventobj.newvalue) then
exit sub
else
selectedProcess=cstr(eventobj.newvalue) 'this works
end if
dim strjunk
' Get the selected node
Dim selectedNode, objSingleNode, objNode2
set selectednode=nothing
Set selectedNode =XDocument.GetDOM("UV_Proposal_Process_Maint")
set objSingleNode=nothing
'next line works
Set objSingleNode=selectedNode.selectSingleNode("//d:UV_Proposal_Process_Maint[@ProcessID='" & selectedProcess & "']")
strjunk=objsinglenode.attributes.getnameditem("Speed").text
intSpeed=cint(strjunk)
msgbox ("current speed is ") & strjunk
set objnode2=nothing
set objNode2=eventObj.Source.ParentNode.SelectSingleNode("//d:UT_Proposal_Process[@ProcessID='" & selectedProcess & "']")
objNode2.SelectSingleNode("//dfs:dataFields/d:UT_Proposal/d:UT_Proposal_Process/@Speed").text=strjunk
End Sub
In the code above the "selectedProcess" variable is the one in the drop down, then it goes and grabs the speed variable from the database. It appears to be getting the new process and the proper speed in the 2nd and 3rd rows fine (using eventobj.newvalue), but when I change the text box, it always changes the 1st row, not the new processes row.
Any ideas on what I am doing wrong in setting text box?
Any help appreciated, thanks much in advance.!!!