Using the XmlFormView Web Part with InfoPath Forms
In this earlier post I briefly describe how to embed an InfoPath form in a SharePoint Web Part Page using the XmlFormView web part. I’ve been asked on many occasions to provide a more detailed account.
You can find the step-by-step guide to embedding an InfoPath form in an XmlFormView web part in a white paper at http://www.nickgrattan.net/Publications.aspx. This document also shows how to create a Submit button to override the normal “Save” option on InfoPath forms.
Updated September 2009: Now includes instructions on creating a web part page using Microsoft SharePoint Designer for XmlFormView web parts. This is much easier than using the browser.
Hi…Thanks for the great post!
i have a problem here.. i have a ASPX page that contains XmlFormView Control to render forms that’s already designed using InfoPath.. i can render the form with its toolbars containing Save, Save As, Submit, Close, ……
when i click on save the form is saved in Ms Forms Server, my case is that i want to use another button to do that!!!! i.e i want to add a button on my ASPX page, once clicked, i want the save operation to be done automaticall without clicking on Save button on the form toolbar!! which means that i want to perform saving a form programmatically.
any ideas?? i need help in this.
plz, email me at omomani@esensesoftware.com
OMomani
January 3, 2008 at 2:17 pm
Hi all…
i have a problem here.. i have a ASPX page that contains XmlFormView Control to render forms that’s already designed using InfoPath.. i can render the form with its toolbars containing Save, Save As, Submit, Close, ……
when i click on save the form is saved in Ms Forms Server, my case is that i want to use another button to do that!!!! i.e i want to add a button on my ASPX page, once clicked, i want the save operation to be done automaticall without clicking on Save button on the form toolbar!! which means that i want to perform saving a form programmatically.
any ideas?? i need help in this.
plz, email me at omomani@esensesoftware.com
OMomani
January 3, 2008 at 3:43 pm
Thank you!
The How To is clear and works fine!
Now, my answers are:
Is possible to to the same (Using the XmlFormView Web Part with InfoPath Forms) by using the “New” button of document library?
Is possible to to the same (Using the XmlFormView Web Part with InfoPath Forms) by editng an existing document?
Fabio
January 3, 2008 at 3:59 pm
Thanks very much for the post and the tutorial. Everything worked like a charm. Great solution.
Chris
April 22, 2008 at 1:40 pm
[...] in SharePoint Published July 19, 2007 SharePoint This post has been replaced with this one! This provides a link to a comprehensive document describing this [...]
Embedding InfoPath Forms Service Forms in SharePoint « Nick Grattan’s Techy Blog
May 4, 2008 at 7:33 am
I have the same question as Fabio …
Can you associate this new ASPX page (web part page) with the new button on a forms library list.
Basically I currently have the InfoPath form as a Content Type and that content type is associated to my Forms Library List … works fine. Now I just want to change it to the new ASPX so it can have the same look and feel as the rest of the Sharepoint site.
Help!? Please!?
Aaron
June 5, 2008 at 4:25 pm
I think you’ll find the answer in this blog post – just change the “New Item Form”. Hopefully this will work for you. Nick.
http://nickgrattan.wordpress.com/2008/05/29/chaning-page-used-to-display-items-in-a-list/
Nick Grattan
June 5, 2008 at 4:56 pm
Hi – I am using a xmlformview web part to display an infopath form. all works as expected thanks to your clear directions, however, the theme that i have applied to the site is overridden in this page. how can i fix this?
thanks,
kathy
September 24, 2008 at 5:35 pm
I think you could use code from this page – it might be useful:
http://www.superslimak.pl/zawodowo/art_tech/INFOPATHFORMVIEWER/index.php
MB
September 29, 2008 at 11:03 am
Thanks so much for your step by step guide. It is the best tutorial on the subject I have found. The main advantage for me is that I can now provide site users with a direct link to an infopath form that is open and ready to fill out, eliminating the need to click the New button. I tried to provide the same functionality with a direct link into the form library using the documented query string arguments, but I ran into issues involving url truncation. This seems to work much better.
Joel Daniels
July 10, 2009 at 1:08 pm
Great idea, but will this work over the long run?
Brit-Biering
July 30, 2009 at 12:56 am
XmlFormView is a standard web part provided by Microsoft in Forms Server. All we’re doing here is making it available to SharePoint sites. Therefore, I think this solution is long term viable. Nick
Nick Grattan
July 30, 2009 at 7:22 am
Hi,
How do I change the list so that when I click “new” or try to “edit” an item it opens in a webpart page with the XMLFormView. Right now I’m always being redirected to a infopath page.
Fraser
August 17, 2009 at 10:07 pm
In SharePoint Designer, right-click the list or document library and select “Properties”. Click the “Supporting Files” tab. Make sure the correct content type is selected and change the link for “New”. HTH, Nick.
Nick Grattan
August 18, 2009 at 7:34 am
Not sure how to make sure the correct content type is selected. But I changed both the New and Edit properties but it doesn’t work. As soon as click new, it opens the “_layouts/FormServer.aspx” page and I’m into the InfoPath Browser view. It’s the same for editing an item.
Fraser
August 18, 2009 at 4:53 pm
Your tutorial seem to work for simple form templates containing no VB or C# code. However, if I add programming codes to the form, the template can no longer be uploaded to a document library. Instead, the template must be activated by administrator and use as content type in document libraries.
The XsnLocation used in tutorial is http://moss2007/TestInfoPathTemplate/Forms/template.xsn.
So for a administrator activated template, I tried using http://moss2007/FormServerTemplates/Forms/mytemplate.xsn for XsnLocation. That does not work.
Then I changed XsnLocation back to http://moss2007/TestInfoPathTemplate/Forms/template.xsn and copied mytemplate.xsn from http://moss2007/FormServerTemplates/Forms/ to http://moss2007/TestInfoPathTemplate/Forms/template.xsn. That does not work.
Jason
September 10, 2009 at 10:45 pm
Firstly, thanks for the most required discussion.
I have a problem. I am showing my form in the XMLFormView webpart and saving and submitting to a list at the back end. All seems fine.
Now I have a requirement that if the user fills the form partially and wants to come back to fill the rest. The partially saved form gets saved in the document library and the webpart shows a new instance altogether.
Now how can I open a saved instance of a form in the XMLFormView webpart.
Please help.
Thanks a lot.
Tina
September 30, 2009 at 10:31 pm
Hi Nick
My InfoPath Form contains a Ritch Text Box (RTB) and it is browsable.
If it gets executed and I click into the RTB I get a nice little toolbar displayed (Bold, color, etc.).
But if the same form is hosted by the XmlFormView WebPart, this toolbar is not there anymore. Instead I get a Script error: Object required in my aspx page.
Any ideas how to fix that?
Rene
October 7, 2009 at 10:39 am
Rene, I’ve just tested this with a simple form and it seems to work fine for the simple case. Did you click the “Enable browser-compatible settings only” check box for the “Display” tab in the “Rich Text Box Properties” dialog for the RTB? Nick.
Nick Grattan
October 7, 2009 at 11:58 am
Nick,
Great Tutorial. This is just what I have been looking for. I do have one problem. My aspx documents end up in the “Documents” list and if I open one of them everything looks great! However, after updating the Document Libraries properties on the “Supporting Files” and “Settings” tabs from Sharepoint Designer, my documents are not displayed within SharePoint but loaded into Sharepoint Designer. And that seems to be th case with any .aspx page. Any Ideas?
Jerry Leckness
October 27, 2009 at 2:33 pm
Not sure why you’re changing “Supporting Files” settings on this library. One mistake often made when doing this is to change the settings for the wrong content type. Nick.
Nick Grattan
October 30, 2009 at 7:13 am
Hi,
Excellent document by the way. I was able to get this to work perfectly on one machine, but I have two others that won’t work. Having had great success with one, I’m confident I followed the instructions; here’s the hitch: after editing the web config, I go to the web part gallery and click New. The Microsoft.Office…XmlFormView does not appear in the list.
Any idea why that would be the case (on two other machines now).
Thanks in advance.
Chuck Duncan
Chuck Duncan
January 24, 2010 at 3:16 pm
Chuck, Thanks for your comments. Is it possible that the other two machines do not have Enterprise edition installed, or have WSS? XmlFormView is only supported on Enterprise. Cheers, Nick.
Nick Grattan
January 25, 2010 at 7:59 am
I have used XmlFormView, and the webpart customization went successfuly, but I want the form to open inside the customized webpart page in browser, when I edit or create a new item in a form library with this form as an approved content type. when I try to use the webpart page as a template in this form library, wss opens the webpart page (*.aspx) with SharePoint Designer, instead of the browser.
Thanks in advance…
Luiz
March 10, 2010 at 3:59 pm
Great document, Nick! Just what we needed here, thanks. We need more articles like this.
anon
March 17, 2010 at 2:59 pm
Hi,
Thanks for the post. This all works well until the form is submitted – then I get “The Form has now been closed” message and I cannot do anything else on this page. I want users to be redirected to the document library the form is submitting to – and when a new user wants to fill out the form they see a blank form in the xml webpart. Im not sure if Im just missing a step.Do you have any idea how I can do this?
Thanks for your help.
Ciara
April 21, 2010 at 6:02 am
Ciara, I’ve struggled with this in the past and have not found a solution. Ideally, it should be possible to create an submit action on the InfoPath form that will redirect once the submit is complete, but I’ve not found a way of doing this. Nick.
Nick Grattan
April 21, 2010 at 7:07 am
Nice post … good stuff ….. But I have one question. I have a button on ASP.NET page containing XmlFormView. I do not want to use submit button inside the infopath form but rather I want to perform submit operation when ASP.NET button is clicked. Is there a way to do this ?
Dhaval
October 2, 2011 at 11:59 pm
Hi Dhaval, Thanks for the comment. To the best of my knowedge, this cannot be done. However, others may have a solution? Regards, Nick
Nick Grattan
October 3, 2011 at 6:10 am
hi,
even though i created an entry in web config file stiil i am not able to activate xmlformviewer in sharepoint server 2010.
any help is appreciated
thanks,
Gaurav
jassi
January 31, 2012 at 11:40 am
We have created many Browser Based InfoPath forms and used the XMLFormView control to display controls in webparts. The Webpart has a button which when clicked sets a value for a field in the InfoPath form. Now this field also has some rules like submitting to a sharepoint library and setting other flags on the form. So the sequence of event is as follows:
1.User clicks on the button
2.Button sets the value “1″ in the field
3.A rule is configured on this field i.e. which checks that if 1 is found in the field it will execute a rule with number of actions. The actions include settings some values in the fields and also submitting to a data connection
Now this worked great in SharePoint 2007 and InfoPath 2007.
Now we are in process of migrating to SharePoint 2010. However during our trial migration we found that this has stopped working. When we set something on the field in InfoPath form the value get set to the field but the rule never execute. And InfoPath form says that “Some rules are not applied” and in the error details say “Exception of type ‘Microsoft.Office.InfoPath.Server.Util.InfoPathFatalException’ was thrown.
please help.
sandeep
February 23, 2012 at 10:39 am
Hey Sandeep,
Did you ever find a solution to this?
Thanks
SP2010 Migration issue
March 10, 2012 at 3:18 am
Hi Sandeep,
Have you found any solution for your post on feb 23rd.I am facing the same issue while setitng value to the infopath form field and that field has some rules to execute.
Your soonest reply is much appreciated!!
Thanks
Amba
Amba
March 22, 2012 at 2:30 pm