Child Node Loop - InfoPath Dev
in

InfoPath Dev

Child Node Loop

Last post 06-05-2008 12:30 PM by jonthemoon. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 03-03-2008 09:11 AM

    Child Node Loop

    Hello,

    I spent quite a bit of time to come up with a simple VBScript loop to clear all nodes on an InfoPath 2003 form.  This is what I came up with:

    Sub ClearAllNodes()

     Dim objNode

     On Error Resume Next

     For Each objNode In XDocument.DOM.selectSingleNode("//my:myFields").childNodes
      objNode.text=""
     Next

    End Sub

    Well, this was great until I realized that I need to develop my form in InfoPath 2007, and I can no longer use this code for a Browser Enabled Form.  Can anyone please help me understand how to loop through Child Nodes to execute this simple procedure?  Or perhaps someone may know a better way to convert my managed code into the new object model than what is described here: http://msdn2.microsoft.com/en-us/library/bb643160.aspx ---> didn't work for me.

     

    Filed under: , ,
  • 03-03-2008 04:14 PM In reply to

    What are you trying to accomplish?

    You just want to reset values or copy values from secondary to main?

  • 03-04-2008 06:15 AM In reply to

    Hi Clay, thanks for the response.

    At this point I'm just trying to reset the values, and hopefully gain a bit of insight into the object model. 

    I'm brand new to VB.Net and XPath.  I've been able to find some info, but most of it is predicated on setting an XPathDocument from a network location (as opposed to the current InfoPath form).  Any help or guidance to resources would be much appreciated. 

     

    Thanks,

    Matt

  • 03-04-2008 06:46 AM In reply to

    For a reset I usually just enter a new query parameter but one that does not relate to any data.  ID=99999999999 or something.

    Then the returned data fields will all be blank.

    All values reset to empty.

  • 03-04-2008 07:27 AM In reply to

    that'll do the job... thanks!

  • 06-05-2008 12:30 PM In reply to

    That's what I'm looking for. How do I do that? Resetting my document datasource? (I'm on Infopath 2003 and need to do that in the .js file)

    Thanks! 

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