So, now I'm trying to use that information to refresh all the data in those nodes by values stored in another data set. The complete code is:
function XDocument::OnLoad(eventObj)
{
var objTranslation = XDocument.DataObjects("ThirdPartyEvent_Translations").DOM; objTranslation.setProperty("SelectionNamespaces",'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" ' + ' xmlns:d="http://schemas.microsoft.com/office/infopath/2003/ado/dataFields"');
var selectedLanguage = XDocument.DOM.selectSingleNode("/my:myFields/my:languageview").text;
var oNode = null
var transtring = ""
var oNodes = XDocument.DOM.selectNodes("//my:myFields/my:labels/*")
while (oNode = oNodes.nextNode())
{ transtring = objTranslation.selectSingleNode("//dfs:myFields/dfs:dataFields/dfs:ThirdPartyEvent_Translations/@Translation[../@stringID = 'user_sectionhead' and ../@languageid = '" + selectedLanguage + "']").text
if (transtring != null)
{XDocument.DOM.selectSingleNode("/my:myFields/my:labels/" + oNode.nodeName).text = transtring}
}
}
The above code WORKS! But, all the labels are painted with the corresponding text to the user_sectionhead stringid.
The problem I am running in to is that when I try to replace 'user_sectionhead' (one of the names of my nodes under labels) I get a Object required error. Here is the syntax that IS NOT WORKING:
transtring = objTranslation.selectSingleNode("//dfs:myFields/dfs:dataFields/dfs:ThirdPartyEvent_Translations/@Translation[../@stringID = '" + oNode.nodeName + "'and ../@languageid = '" + selectedLanguage + "']").text
Could it be that oNode.nodeName is not "text" and needs to be converted to a string?