in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

Blog for Sharepoint Hunter

A (un)managed bag of ideas, tricks, gripes about New Emerging Technologies

Close New Opened Infopath form automatically

I'd a situation as subject stated. I've to close the infopath form(opened in a new window) after the form has been submited sucessfully. As aware, if it's being open in a same window, we can achive this task by mentioning "Source" element in the Url. BUT, If it's opend in a new window, no use of specifing "Source" element with Url. So, we need to do some workaround for this problem.

Here's my solution/workaround for it:-

1. Create a html page called ("WindowClose.htm)

2. Copy and paste the following code snippet and save it under "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS" folder

<html>
<head>
<script language="javascript">
function closewindow() {
self.opener = this;
self.close();
}
</script>
</head>
<body onload="closewindow();">
</body>
</html>

3. Now, specify this file as source in your url. i.e.,

http://[myserver]/_layouts/FormServer.aspx?XsnLocation=/FormServerTemplates/TestForm.xsn&Source=/_layouts/windowclose.htm&DefaultItemOpen=1&PersonalInfoID=196

4. Test your application by open/submit an infopath form in a new window

In real time scenario, We've been facing this kind of issues in BDC with Infopath form. From BDC, users can search and they would like to modify the record in a new window using Infopath, user has to close the form once they done their job. To avoid these head ache, we can make use of above work around.

Hope this helps!

Comments

 

JL said:

Thanks for sharing. I've been looking for a workaround to close the form after submitting. I wanted to use Form Server to submit forms without giving access to SharePoint at submitters. Closing the browser should be the default behaviour when the source parameter is missing.

November 2, 2007 2:22 PM
 

JimE said:

Not sure if it is to late to jump in here. I am a tad confused.

My goal is to have InfoPath 2007 close after submition to a MOSS form library. As it stands, the form closes just fine after submit, but InfoPath the program stays open and does not close. Clearly I want it to go back to the doc lib. Am I missing something? Any help would be appreciated.

February 28, 2008 10:37 PM
 

Johnson said:

Jim,

 Please specify your doc lib path to Source.

Thanks,

Johnson

March 27, 2008 4:10 PM
 

Delia F said:

Beautiful!  thank you so much.  This solution is clean and elegant - makes good sense.  I am sure it will do the trick for me in Designer as well.  Why CLOSE window is not an option within the Designer interface,  I'll never know.  Such a basic function!

May 2, 2008 4:39 PM

Leave a Comment

(required )  
(optional )
(required )  
Add

Need SharePoint Training? Attend a SharePoint Bootcamp!

Posts (c) their respective authors. Everything else (c) 2007 SharePoint Experts