Insert optional section in VB.Net - InfoPath Dev
in

InfoPath Dev

Insert optional section in VB.Net

Last post 11-09-2006 09:26 PM by Shiva. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 11-09-2006 02:39 PM

    Insert optional section in VB.Net

    I have an optional section in my form. I hope I can insert more by code in VB.NET.

    First of all, I have tried thisXDocument.View.ExecuteAction("xOptional::insert", "repeatable section name"). It didn't work.

    I am trying to use appendChild. the code is showed below:

    oRepeatSectionNode = thisXDocument.DOM.selectSingleNode("Xpath")
    domXMLNode = thisXDocument.CreateDOM()
    domXMLNode.async = False
    domXMLNode.loadXML(oRepeatSectionNode.xml)
    thisXDocument.UI.Alert(domXMLNode.xml)
    oParentNode = thisXDocument.DOM.selectSingleNodeXpath")

    ' so far it is good, but an error occured in following code:
    oParentNode.appendChild(domXMLNode.documentElement)

    Error: Element 'SectionNodeName' is unexpected according to content model of parent element 'SectionParentNodeName'.


    I have spent whole day, but no luck.

    Thanks in advance.

    Eugene,

  • 11-09-2006 09:26 PM In reply to

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

    Re: Insert optional section in VB.Net

    Hi Eugene,

    Here is one way of adding a new row to the repeating table.

    //write get the XML of repeating node into a string
    string sRepeatingXml = "<LogEntries><name>NameValue</name><age>Agevalue</age></LogEntries>";

    //create a Dom for the XMLNode
    IXMLDOMDocument oXml = thisXDocument.CreateDOM();
    oXml.async = false;
    oXml.loadXML(sRepeatingXml);

    //Get the Parent of the repeating table
    ixmldomNode parentofRepeatingNode = getNode("XPath");

    //append the repeating XML Element to the Parent node
    parentofRepeatingNode.appendChild(oXml.documentElement);
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.