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

October 2007 - Posts

  • 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!


Need SharePoint Training? Attend a SharePoint Bootcamp!

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