Cant get form to clear after submit in Code (2003) - InfoPath Dev
in

InfoPath Dev

Cant get form to clear after submit in Code (2003)

Last post 09-18-2008 09:35 AM by aesalazar. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 09-17-2008 04:43 PM

    Cant get form to clear after submit in Code (2003)

    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

  • 09-18-2008 05:51 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: Cant get form to clear after submit in Code (2003)

    Hello,

    You have to check ‘newDataFields' node and ‘existingDataFields' node structure is same or not? In these you might have different values but replacing with new child node is should be equal to old child node structure. You have to verify this replacing new child is under the ‘existingDataFields.parentNode' node only. If new child or old child node structure is different you will get error.

  • 09-18-2008 09:35 AM In reply to

    Re: Cant get form to clear after submit in Code (2003)

     Thanks for the reply.

     It turns out, it was the line:

    newDOM.load("TJ_Template.xml");

     

    I change it to "Template.xml" and that solved it.

     Ernie

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