Reset a Form - InfoPath Dev
in

InfoPath Dev

Reset a Form

Last post 05-15-2011 03:29 PM by Skarn. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 05-13-2011 12:50 PM

    Reset a Form

    Does anyone know how to reset a form in Infopath 2003. We have a button that is set to open the template and close the current form without prompt, but it seems like in 2003 this is just not working correctly. Is there a different solution that someone might have?

  • 05-15-2011 03:29 PM In reply to

    • Skarn
    • Top 50 Contributor
      Male
    • Joined on 04-20-2008
    • Australia
    • Posts 198

    This sounds like a question which might have been asked before.
    But I decided not to search myself - but still try and give you an answer.
    Maybe there are better methods already, or this could be one which hasn't been done.

    This is a JScript method which I place behind a button.

    //load the template.xml file into a new memory XML DOM
    var domSample = XDocument.CreateDOM();
    domSample.load("template.xml");

    //collect all the nodes of the form (except root node)
    var nodeChildren = XDocument.DOM.selectNodes("//my:myFields/*");

    //loop through collection of nodes and remove each one
    for(var i=0; i < nodeChildren.length; i++)
    {
            nodeChildren.item(i).parentNode.removeChild(nodeChildren.item(i));
    }

    //'merge' the template.xml back into the form
    XDocument.ImportDOM(domSample);

     

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