4
votes

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)?

4
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
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://<site>/_layouts/FormServer.aspx?XmlLocation=<xml_file_location>&DefaultItemOpen=1&view=View3 and read the value of the view query string in the code behind.sh_kamalh

4 Answers

1
votes

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);
}
0
votes

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).

0
votes

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.