Reset form fields - InfoPath Dev

InfoPath Dev

Use our Google Custom Search for best site search results.

Reset form fields

Last post 09-30-2010 06:37 AM by Dremandred. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 09-09-2010 06:19 AM

    Reset form fields

    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");
     // 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.


  • 09-30-2010 06:37 AM In reply to

    Finaly after much frustration, I got this code to work correctly.

     It seems this function needs xmlDoc.validateOnParse = false; before the initialData is loaded into xmlDoc.


    What I don't understand is why would the DTD validation check on an XML segment change xmlDoc.documentElement to an invalid argument when if the check is not done the code runs through as expected?




Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.