Aug 25, 2009

Embedded InfoPath Form on SharePoint Page

Looking to publish an InfoPath form on a SharePoint page, I encountered a couple disturbing problems:
1) the new form to fill needs to be launched from the library, which certainly isn't something I want on a public website
2) the form opens out of the website, as it's own webpage, out of the website navigation

After some googling I found one rather nice looking solution: use the Form View Web Part. Only thing is, that even though it's natively SharePoint, it's not declared on SharePoint sites for use. So before it can be used, it needs to be enabled, and that means eg. editing the web.config file - not a recommendable thing to do, really. (Yet, if this is what you want to do, instructions can be found eg. in Elczar's blog.)

However, there are more simple means of showing an InfoPath form on a SharePoint page. You can simply use the Content Editor Web Part with an iFrame showing the new form as a web page, but even more simple is to use the Page Viewer Web Part and show the new form as web page in it. This works on any page with web part zones, but looks nicest when it is the only web part on the page, eg. on a one-column page layout page.

Add a Page Viewer Web Part on the page where you want to display the form. Then click to open the tool pane of the web part. In the toolpane, set the page link to open the new form. You can retreive this url by navigating (in another window/tab) to your form library, click "New" and copy the url of the form page that opens.

You might also want to change or hide the title and adjust the height and width of the web part for better user experience.

Now each time the page is loaded, a new form is shown on the page. Only thing still bothering me is the toolbar - closing the form takes the user to the form library and this really isn't something I want to happen! But unfortunately I haven't come up with anything to fix this just yet.

And another issue is the library itself - even though I want users to be able to fill in and submit forms, I don't want them to have access to forms saved/submitted by others. Thus, if the forms are saved to the forms library, there needs to be a workflow moving each form to some other library right away. That at least is fixable ;)

Ofcourse, there are some third party solutions for this as well, but I have no idea how they differ from the SharePoint native web part - except for their installation I believe. I assume they are deployed as features or solutions that don't require hand-made repairs to any original files.


Anonymous said...

Thank you!! This saved me a lot of headache!

Anonymous said...

and, one way to avaoid the issue of exposing the form library is to config the infopath form to remain open after submit (not ideal, but lesser of two evils)

Maid Service Lafayette said...

Hi nice reading yyour blog