appendchild to a repeating table - InfoPath Dev
in

InfoPath Dev

appendchild to a repeating table

Last post 03-14-2006 06:55 AM by fredarwin. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 03-13-2006 12:25 PM

    appendchild to a repeating table

    scenario:
    My main connection is binding to a webservice that bring master table an to details tables.

    Orders
    ItemsbyOrder (Repeating Group)
    field1
    field2
    CustomersbyOrder((Repeating Group))
    fieldX

    I am using a repeating table to add rows by code throught a button click to my itemsbyOrder, but when i try to add the row ip send me the next message:

    "according to content model of parent element 'Orders', the element 'ItemsbyOrder' ss unexpected.
    CustomerbyOrder is expected."

    this is my code:
    var row = XDocument.DOM.selectSingleNode("//ItemsbyOrder");
    row = row.cloneNode(true);
    row.selectSingleNode("field1").text = "xProduct";

    var parent = XDocument.DOM.selectSingleNode("my:myfield/my:Orders");
    parent.appendChild(row);


    any advise???



  • 03-14-2006 06:03 AM In reply to

    Re: appendchild to a repeating table

    Hi Fredarwin,

    I too had the same problem once upon a time.Just forgot as to how I solved it.
    But from what I remember....
    Did u change the relative position of ItemsbyOrder (Repeating Group) and CustomersbyOrder((Repeating Group))
    i.e did u move ItemsbyOrder above CustomersbyOrder???
    i.e in the DataSource Taskpane,did u select ItemsbyOrder and move up???

    I dont know y it happens,but as from what I remember,I too moved one repeating group above the other in the datasource taskpane.
    And I too got the same error.
    So I think what I did was, get the repeating groups to the previous position.

    :)) very wierd.But try it.I think it should solve.
    regards,
    Abhishek
  • 03-14-2006 06:55 AM In reply to

    Re: appendchild to a repeating table

    thanks Abhishek,

    I find a solution.

    I had to change the appendchild with insertBefore method.

    Really i don´t understand why i can´t use appendchild but maybe because the parent (Orders) is expecting to add two repeating nodes:
    ItemsbyOrder and CustomersbyOrder.
    This is solved if we create a not repeating group and we move the repeating group inside, therefore my parent right now is my new group created. But in some cases like using webservices create group is disabled.
    Advise, use insertBefore, method.

    Regards,

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