Hey guys. I have a form setup with an OnSubmitRequest function setup in JScript. After the form is submittted, I would like to have it clear (just like the option if you use the UI Submit button). I wrote the following based on what I found on this forum and various tinkering but I keep getting runtime errors (null objects):
function Reload_Form()
{
var newDOM = new ActiveXObject("Msxml2.DOMDocument.5.0");
newDOM.async = false;
newDOM.validateOnParse = false;
newDOM.load("TJ_Template.xml");
var ns = XDocument.DOM.getProperty("SelectionNamespaces");
var existingDataFields = XDocument.DOM.selectSingleNode("//dfs:myFields");
newDOM.setProperty("SelectionNamespaces", ns);
var newDataFields = domTemplate.selectNodes("//dfs:myFields");
existingDataFields.parentNode.replaceChild(newDataFields.cloneNode(true), existingDataFields);
}
The form name is TJ_Template.xsn. I tried selectNodes instead of selectSingleNode, //my:Fields instead of //dfs:myFields, CreateObject instead of ActiveXObject, and so on but always end up with a similar runtime time error. Am I missing something?
Thanks
Ernie