Closing an embedded InfoPath form in SharePoint

In the previous blog post, a technique was described for embedding a browser-enabled InfoPath form in a SharePoint web part page. This was done using a standard XML Form View web part and allows the navigation context of the page to be retained. The only disadvantage of using this technique is that it is not possible to close the InfoPath form and return to the original Document Library, as would be the case with a normal document library or SharePoint list.

The InfoPath forms server displays a simple message that the form has been closed, as follows:

If this behavior poses a problem to users, then an alternative XML web part is available, which allows for additional URL strings to be passed containing the address of the page which should be returned to after the InfoPath form has been saved.

Ensure that the InfoPathFormViewer web part is available in the Site Collection Web Part Gallery and insert into a basic web part page.



Set the parameters under the Miscellaneous section as follows:




<div class=”EForms”> <div class=”EForms2″> <div class=”EForms3″> <div style =”text-align:center;margin-top:10px;”> <iframe src=”%formurl%” width=99% scrolling=no frameborder=0 marginwidth=0 marginheight=0 height=600 >info path here</iframe> </div> </div> </div> </div>



Form URL



Note that to return to a specific page, it is necessary to add a Source URL parameter, alongside the Xsn and Save Locations.

This will allow the InfoPath form to close and for the default AllItems view to be loaded. However, as the form is in an IFrame, the page will load into the frame unless some JavaScript is used to escape from the frame.

This code should be entered in a Content Editor web part positioned in the All Items view page before any other web parts.



<SCRIPT TYPE=”text/javascript”>



if (top.frames.length!=0)




// –>




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: