scripting on a repeating section - InfoPath Dev
in

InfoPath Dev

scripting on a repeating section

Last post 02-21-2006 03:01 AM by Superfly1611. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 02-21-2006 03:01 AM

    scripting on a repeating section

    Hello,

    I'm trying to write a javascript for the on_load event of my infopath form.
    The main body of my form is contained within a repeating section. Every time the user opens the infopath form I want the top node in the repeating section to be cloned and placed at the top as a kind of version control mechanism.

    I have tried the following code:

    function XDocument::OnLoad(eventObj)
    {
    var parent = XDocument.DOM.selectSingleNode("/my:myFields/my:group1/my:versions");
    var newChild = parent.selectSingleNode("my:version[1]").cloneNode(true);
    parent.insertBefore(newChild,parent.selectSingleNode("my:version[1]"));
    }


    The error that I am getting is that the new my:version child element is "unexpected according to content model of parent element"

    This makes no sense to me because the my:version element definately belongs to the my:versions parent element in the xml data structure that is produced by the infopath form.

    I'm pretty new to both infopath and xml scripting so any help you can offer me would be extremely helpful

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