Launch new form with content from current form - InfoPath Dev
in

InfoPath Dev

Launch new form with content from current form

Last post 11-22-2005 10:40 PM by Coita Thierry. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 11-15-2005 10:14 AM

    • drobins
    • Top 500 Contributor
    • Joined on 08-17-2005
    • Canada
    • Posts 47

    Launch new form with content from current form

    I have a form that goes through a 3 step work flow. At the end of the work flow I would like to have a button or link that would launch a new form containing information from the current form.

    Is this possible?
  • 11-15-2005 03:00 PM In reply to

    Re: Launch new form with content from current form

  • 11-15-2005 10:33 PM In reply to

    Re: Launch new form with content from current form

    Hi DRobins,
    Add a state field to your main data source in in your form and create an optional section that conditionally shows only when the forms is in the state that you want. Put a button inside this section. That should do it.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 11-16-2005 06:04 AM In reply to

    • drobins
    • Top 500 Contributor
    • Joined on 08-17-2005
    • Canada
    • Posts 47

    Re: Launch new form with content from current form

    i know how to make the button appear, I can't figure out how to launch the next form (which i have already created) and populate some fields with information from the first form

    Franck, that seems like it wants to create a new form. I want to send just field contents from one form to the other form.
  • 11-16-2005 11:36 PM In reply to

    Re: Launch new form with content from current form

    Hi,

    If you not the path of your other form you can do like this:

    XDocument oXdNewForm = thisApplication.XDocuments.NewFromSolution(@"C:\Program Files\InfopathPow\AV.xsn"); 

    IXMLDOMDocument2 newDocument = (IXMLDOMDocument2)thisXDocument.CreateDOM();
    newDocument.loadXML(resultf.ToString());
    newDocument.setProperty("SelectionNamespaces", "xmlns:dfs=\"http://schemas.
    microsoft.com/office/infopath/2003/dataFormSolution\"
    xmlns:ns1=\"http://schemas.xmlsoap.org/wsdl/soap/\"");
    IXMLDOMNode oNode = newDocument.selectSingleNode("/Case");

    IXMLDOMNode AV = oXdNewForm.DOM.selectSingleNode("/CaseList/Case");
    AV.parentNode.replaceChild(oNode, AV);
    thisApplication.XDocuments.Close(0);


    It's the same way if you want to change text of node!

    ++

    Thierry

    Every moment hesitated is a moment gone for life!!! Think about it
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 11-22-2005 01:08 PM In reply to

    • drobins
    • Top 500 Contributor
    • Joined on 08-17-2005
    • Canada
    • Posts 47

    Re: Launch new form with content from current form

    Virgul,

    I think that is what I want to do.

    I tried to add that code to the onclick of a button and changed all the pertinent code to reflect my forms and fields.

    When I preview the form I get an error saying "expected ';'" on line 24 which is the
    "XDocument oXdNewForm = thisApplication.XDocuments...." line

    here is my code(will this work from preview if I put in the path to the other form?):

    function CTRL3_5::OnClick(eventObj)
    {
    XDocument oXdNewForm = thisApplication.XDocuments.NewFromSolution(@"\\server1\users$\drobins\My Documents\Template2.xsn");

    IXMLDOMDocument2 newDocument = (IXMLDOMDocument2)thisXDocument.CreateDOM();
    newDocument.loadXML(resultf.ToString());
    newDocument.setProperty("SelectionNamespaces", "xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\" xmlns:ns1=\"http://schemas.xmlsoap.org/wsdl/soap/\"");
    IXMLDOMNode oNode = newDocument.selectSingleNode("/my:myFields/my:myFields:field1");

    IXMLDOMNode AV = oXdNewForm.DOM.selectSingleNode("/my:myFields/my:myFields:field1");
    AV.parentNode.replaceChild(oNode, AV);
    thisApplication.XDocuments.Close(0);
    }
  • 11-22-2005 10:40 PM In reply to

    Re: Launch new form with content from current form

    Hi,

    That don't go when you are in preview mode so please publish and after try (security)!

    Second if that always don't work try to load for example a xml from this path for see if your path is correct!

    Other things (your code):

    newDocument.setProperty("SelectionNamespaces", "xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\" xmlns:ns1=\"http://schemas.xmlsoap.org/wsdl/soap/\"");
    IXMLDOMNode oNode = newDocument.selectSingleNode("/my:myFields/my:myFields:field1");


    If youtry to navigate on the my: prefix you need to declare our my namespace not ns1: or dfs! The declaration of namespace my for your form is at the top of the formcode.cs!

    ++
    Thierry

    Every moment hesitated is a moment gone for life!!! Think about it
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.