I came across a site that shows how reset the forms data however when trying to impliment this I get an "Invalid procedure call or argument" exception on the final line of code.
var initialData;
function XDocument::OnLoad(eventObj)
{
initialData = XDocument.DOM.selectSingleNode("/my:myFields/my:container").xml;
}
function CTRL3_5::OnClick(eventObj)
{
// Load the initial saved XML into a DomDocument object
var xmlDoc = new ActiveXObject("MSXML2.DomDocument.5.0");
xmlDoc.loadXML(initialData);
// Replace my:container
var parentNode = XDocument.DOM.selectSingleNode("/my:myFields");
var oldChildNode = parentNode.selectSingleNode("my:container");
parentNode.replaceChild(xmlDoc.documentElement, oldChildNode);
}
I also ended up changing MSXML2.DomDocument.5.0 to MSXML2.DomDocument.6.0 because when I was debugging I noticed that the xmlDoc.loadXML(initialData); returned false. the change from 5 -6 seems to have done the trick.
Any ideas on why this code doesn't appear to work?
Many thanks.