I'm trying to add entries to a repeating section programmatically just like the example Fully Editable Drop-Down List Box.
Like in the example, I built:
- a group (/my:myFields/my:logHistorySection/my:logHistoryGroup)
- a repeating section with an expression box inside the group
(/my:myFields/my:logHistorySection/my:logHistoryGroup/my:fieldName)
But everytime the code is invoked, an error of "Object doesn't support this property or method" occurs at the line executing "appendChild" method.
This is the code I followed from the sample:
----------------------------------------------------------------------
function msoxd_my_formType::OnAfterChange(eventObj)
{
var logHistoryGroup = XDocument.DOM.selectNodes("/my:myFields/my:logHistorySection/my:logHistoryGroup");
var sOld = eventObj.OldValue;
var sNew = eventObj.NewValue;
if(sNew != "")
{
var oNode = XDocument.DOM.createNode(1, "my:fieldName", "http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-03-04T02:16:49");
oNode.text = "test value";
logHistoryGroup.appendChild(oNode);
}
}
----------------------------------------------------------------------
Any idea why the error is happening?
Thanks :)