Are you opening the second infopath form from within the first
infopath form?
Are you using Javascript or managed code (like C#)?
If you are opening the second form from within the first and are using
C# then you could try the following:
// The following function handler is created by Microsoft Office
InfoPath. Do not
// modify the type or number of arguments.
[InfoPathEventHandler(MatchPath="btnCopy",
EventType=InfoPathEventType.OnClick)]
public void btnCopy_OnClick(DocActionEvent e)
{
// copy current document's XML
IXMLDOMDocument newDoc = thisXDocument.DOM;
// manipulate the data in the copy
newDoc.documentElement.selectSingleNode("/my:myFields/my:field1").text
= "test";
newDoc.documentElement.selectSingleNode("/my:myFields/my:field2").text
= "1";
newDoc.documentElement.selectSingleNode("/my:myFields/my:field3").text
= "test2";
// get the path of the template
string strTemplatePath = getTemplatePath();
// call NewSolutionWithData to open a new Form and load the XML
thisApplication.XDocuments.NewFromSolutionWithData(newDoc.documentElement,
strTemplatePath, (int)XdDocumentVersionMode.xdFailOnVersionOlder);
thisApplication.XDocuments.Close(0);
}
What this does is on the onclick event of a button on the form,
creates a copy of the XML in the document, then manipulates the data
in the copied XML (effectively passing the parameter), then creates a
new instance of InfoPath with the modified (populated) XML.
You could then in your onload event of the form have it use the value
of the node you populated to query a data source to populate other
fields, for example if you passed in an Order ID or such.
Hope this helps.
Michelle Beall
> Tried my usual method of getting an answer to this (Google) and did not find
> a satisfactory one; thought would be simple...
[quoted text clipped - 6 lines]
>
> John
josephjc - 14 Sep 2006 10:17 GMT
Is there a way to do this in javascript please?
I cannot use managed code because Infopath toolkit is only available
for VS 2003 and I have 2005.
10x
--
josephjc
------------------------------------------------------------------------
http://www.mcse.ms
------------------------------------------------------------------------
View this thread: http://www.mcse.ms/message1113194.html
Ben Walters - 18 Sep 2006 00:24 GMT
Hey Joseph,
The InfoPath toolkit is available for VS2005 however it is included as part
of Visual Studio Tools for Office (VSTO), if you have an MSDN subscription
you should be able to download it from there.
Cheers
Ben
> Is there a way to do this in javascript please?
> I cannot use managed code because Infopath toolkit is only available
[quoted text clipped - 7 lines]
> ------------------------------------------------------------------------
> View this thread: http://www.mcse.ms/message1113194.html
Lance M - 20 Sep 2006 14:44 GMT
Hi Joseph,
If you manage to get the toolkit, I have a question for you: are you
going to be doing anything with the form that you are openeing? It
sounds to me like you are just accessing it to look at it's data. If so
there is another way using the DOM and data connections. You could then
select a single node based on whatever the query string criterion are,
and load it into an xmlnode or something similar to look at the data.
If you are modifying the data, chances are you do need to open the form
:p.
Lance M.
> Hey Joseph,
> The InfoPath toolkit is available for VS2005 however it is included as part
[quoted text clipped - 15 lines]
> > ------------------------------------------------------------------------
> > View this thread: http://www.mcse.ms/message1113194.html
josephjc - 25 Sep 2006 11:44 GMT
10x Ben, but I did not manage to get the toolkit. What I really need is
to connect forms together. I am creating a Claims Management System and
want to connect claims form with customer forms. I would like that when
a user submits a claim form a customer form is automatically loaded
with the claim number present.
10x again,
Joseph
--
josephjc
------------------------------------------------------------------------
http://www.mcse.ms
------------------------------------------------------------------------
View this thread: http://www.mcse.ms/message1113194.html