Parameter passing between infopath templates - InfoPath Dev
in

InfoPath Dev

Parameter passing between infopath templates

Last post 09-28-2004 10:45 AM by Greg Collins. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 09-21-2004 07:37 PM

    Parameter passing between infopath templates

    Hi All,

    Is it possible to pass parameters from one infopath template to another via manged code, c#?

    In my scenario, I am trying to pass two fields from template1 to template2. The two values passed will be used to populate into two separate text boxes in template 2.

    All help is deeply appreciated. Many thanks in advance!

  • 09-23-2004 11:25 AM In reply to

    Re: Parameter passing between infopath templates

    When you used the word "template" did you mean that? Or did you mean the live form? There is no communication between templates (i.e. InfoPath Designer), only between forms (i.e. InfoPath Editor).

    As for the editor, you have an XDocuments collection off of the Application object. You can get to all open forms and pass data between them.

    If you launched the secondary form from code, you should have been given an XDocument reference in return. You access that one just like you do your own form's XDocument.

    Greg Collins [InfoPath MVP]
  • 09-26-2004 07:17 PM In reply to

    Re: Parameter passing between infopath templates

    Hi Greg,

    Thanks for your reply.

    Is there any sample code for the launching of secondary form from C# managed code and the access method? I had googled around and couldn't find any examples for it.

    Many thanks in advance
  • 09-27-2004 09:38 AM In reply to

    Re: Parameter passing between infopath templates

    Try this:

    XDocument oXdNewForm = thisApplication.XDocuments.NewFromSolution(@"c:\foo\form.xsn");

    You can also use Rules on a button to open a new form

    Greg Collins [InfoPath MVP]
  • 09-27-2004 06:48 PM In reply to

    Re: Parameter passing between infopath templates

    Hi Greg,

    I had tried the following:
    -----------------------------------------------------------------
    XDocument oXdNewForm = thisApplication.XDocuments.NewFromSolution(sPath+"TestForm.xsn");

    oXdNewForm.DOM.selectSingleNode("/TEST_FORM/Info/ID").text = sID;

    oXdNewForm.DOM.selectSingleNode("/TEST_FORM/Info/Officer").text = sInspectorNm;
    ---------------------------------------------------------------------

    and encountered the following error:

    ---------------------------------------------------------------------
    System.UnauthorizedAccessException
    Access is denied.
    at Microsoft.Office.Interop.InfoPath.SemiTrust.ICLRExtensions.IsCrossDomainSafe(Object punkCallee)

    at Microsoft.Office.Interop.InfoPath.SemiTrust.InfoPathWrapperHelper.CheckCrossDomainSafety(IServiceProvider serviceProviderCallee)

    at Microsoft.Office.Interop.InfoPath.SemiTrust.XDocumentWrapper.get_DOM()

    at Microsoft.Office.Interop.InfoPath.SemiTrust.XDocumentWrapper.get_DOM()

    at PremiseInspectEvents.PremiseInspectEvents.Register_Sample_OnClick(DocActionEvent e) in d:\ava\visual studio projects\premiseinspection\premiseinspectevents\premiseinspectevents\formcode.cs:line 117

    at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)
    ----------------------------------------------------------------------

    What I am trying to do is to set the value of two fields in the secondary form using some data from the current form. In addition to this, both my forms are fully-trusted. Is the fully-trusted an issue?


  • 09-27-2004 07:28 PM In reply to

    Re: Parameter passing between infopath templates

    I had resolve the issue. I had published the secondary form to another domain and try to call the secondary form in my debug mode.

    Once I had published both forms, the error does not occur.

    Thanks for your help Greg!
  • 09-28-2004 10:45 AM In reply to

    Re: Parameter passing between infopath templates

    Glad to help out! And I'm happy you got it working!

    Greg Collins [InfoPath MVP]
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.