4

InfoPath form web part can be used to fill out a published InfoPath form (a new instance). I want to use the web part to open an already filled form to do some modifications. Can this be achieved (using this web part or any other solution)?

The reason behind this requirement is that I want to have multiple web parts in my page, content editor, query string filter and InfoPath web part. I want to use these to open a form (new or existing) in a certain mode / view.

Edit
I will try to simplify:
1- I have an InfoPath form that is saved in a SharePoint library. The form have multiple views.
2- Using a URL like http://mySite/myPage.aspx?form=myForm-20110613.xsn&view=View3, I want the form myForm-20110613.xsn to be opened and switched to View3.

How can I achieve this (preferably without writing any code)?

sh_kamalh
  • 3,853
  • 4
  • 38
  • 50
  • Hey did you find any solution for this? I am facing same issue. how can i achieve this ? what you did for this ? – Red Swan Sep 05 '11 at 12:51
  • No, there is no out of the box solution for this. What you can do is to parse the query string and redirect to another URL and use the loading event of the InfoPath form to read the required view. For the given URL you need to change it to `http:///_layouts/FormServer.aspx?XmlLocation=&DefaultItemOpen=1&view=View3` and read the value of the view query string in the code behind. – sh_kamalh Sep 06 '11 at 05:06

4 Answers4

1

I have done that using a custom application ASPX page. The page has an Iframe that I set its src to the viewing URL as follows

private void SetIFrameSource_View(HtmlControl frame, string libraryName, string formName)
{
    string formServerPage = "http://servername/_layouts/FormServer.aspx";
    string xmlLocation = string.Format("/{0}/{1}", libraryName, formName);
    string source = "http://servername/SitePages/Home.aspx";
    frame.Attributes["src"] = string.Format("{0}?XmlLocation={1}&Source={2}&DefaultItemOpen=1", formServerPage, xmlLocation, source);
}
sh_kamalh
  • 3,853
  • 4
  • 38
  • 50
0

What version of InfoPath are you using? With 2013, you can insert a rule on form opening with no conditions and add action "switch views" to the view you prefer.

Click Data Form Load New Add Action Switch Views (select view).

Bill
  • 1
0

Create a page and add InfoPath form webpart and save the page. Do not configure any properties for the webpart (library name or content type). Navigate to the page including your existing InfoPath form XmlLocation. eg. http://siteurl/yourpage.aspx?XmlLocation=/sites/teamsites/TestFormLibrary/aaaaa.xml

https://devdotnotes.wordpress.com/2012/01/29/sharepoint-caculated-column-and-hyperlink-no-workflow-or-script-needed/

follow this link if you want to build this url dynamically in your view.

  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – ekad Jul 10 '15 at 15:17
-2

You can do this with web part connections. Watch the following video for details: http://channel9.msdn.com/Blogs/laurhar/InfoPath-2010-Manage-data-in-your-SharePoint-Lists-using-the-InfoPath-Form-Web-Part?format=auto

Kirk Liemohn
  • 7,733
  • 9
  • 46
  • 57
  • Sorry for the down-vote but the video has no relation with what I intend to do. I want to open an existing InfoPath form and switch to a view. – sh_kamalh Nov 03 '11 at 07:44
  • Did you watch the entire video? The second half shows you how to connect the list view to the InfoPath Form web part. You click on an item in the list view and it opens in the web part. – Kirk Liemohn Nov 03 '11 at 17:45
  • I already know that but what I want is to open the InfoPath form directly without linking it with a list. Given a URL like the one I specified in my question, I need to open the InfoPath form instance directly. – sh_kamalh Nov 08 '11 at 05:51