Populate values from different form - InfoPath Dev
in

InfoPath Dev

Populate values from different form

Last post 04-20-2006 06:45 PM by SamDahl. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 03-07-2006 06:00 AM

    Populate values from different form

    Hi all,

    is the following possible. Let's assume we have a link in an InfoPath form which opens another InfoPath form (not view). Can I then somehow populate values which has been entered into the first InfoPath form (from which the second gets opened) in the new one ?
    Listen to Motörhead cos they play Rock'n Roll :)
  • 03-07-2006 11:20 AM In reply to

    Re: Populate values from different form

    If you are opening new form from code then you, you will have a reference(XDocument) to the newly opened from in the old form. You can set values in this new forms reference(XDocument).

    If you just have a link in the UI then you will not have referece to the newly opened form, so will not be able to populate the data.
  • 03-08-2006 03:50 AM In reply to

    Re: Populate values from different form

    Hi Agni,

    thx for your hint, it brought me to the solution. For those who wanna do the same here a short snippet:
    XDocument newForm		= thisApplication.XDocuments.NewFromSolution("http://Server/Web/test.xsn");
    IXMLDOMNode node = thisXDocument.DOM.selectSingleNode("my:myFields...");
    IXMLDOMNode testNode = newForm.DOM.selectSingleNode("my:myFields....");
    testNode.text = node.text;
    Listen to Motörhead cos they play Rock'n Roll :)
  • 03-08-2006 04:04 AM In reply to

    Re: Populate values from different form

    Hi, Thanks for providing the code snippet, hope this is helpful for others.
  • 04-20-2006 06:45 PM In reply to

    • SamDahl
    • Top 500 Contributor
    • Joined on 03-28-2006
    • Australia
    • Posts 44

    Re: Populate values from different form

    Here's the javascript solution I've implemented. Just to add another similar example:

    function btnRaiseChange::OnClick(eventObj)
    {
    var xDoc = Application.XDocuments.NewFromSolution("http://test/Forms/template.xsn");


    var sourceNode = XDocument.DOM.selectSingleNode("/my:myFields/my:group4/my:deviceName");
    //had trouble with namespaces so came up with the //*[local-name()='deviceName'] solution
    var destNode = xDoc.DOM.selectSingleNode("//*[local-name()='deviceName']");
    if (destNode != null)
    {
    destNode.text = sourceNode.text;
    }

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