Question

We create a link to a InfoPath client-based form (meaning that the form is open at the client machine which have infopath installed.) by using the following source code inside a Content Editor web part

<IMG alt="" src="/_layouts/images/rect.gif">&nbsp;<A onclick="createNewDocumentWithRedirect('http:\u002f\u002fwww.yoursite.com\u002fsce\u002fSubSiteName\u002fListName\u002fForms\u002ftemplate.xsn', 'http:\u002f\u002fwww.yoursite.com\u002fsce\u002fSubSiteName\u002fListName', 'SharePoint.OpenXmlDocuments.2', true, 'http://www.yoursite.com/SubSiteName/_layouts/FormServer.aspx?XsnLocation=http://www.yoursite.com/SubSiteName/ListName/Forms/template.xsn', 0);return false;" href="#">New ListName Document</A>

whereby

  • www.yoursite.com to the name of your site
  • SubSiteName to the name of the sub site inside your site.
  • ListName to the name of the list that you are performing on.

So, my question is:

Is it possible to use the same function - createNewDocumentWithRedirect to redirect into a web-based infopath form (meaning that when I click the link, it open a web-based infopath form without the need to have Infopath installed on the client machine)?

Was it helpful?

Solution

In your case I believe you need to change only the Form URL you are using with the attribute OpenIn having value "Browser" or the DefaultItemOpen attribute with value 1. Please visit this msdn post for more parameters that can help you with the InfoPath URL.

So your URL will ultimately look like this -

<IMG alt="" src="/_layouts/images/rect.gif">&nbsp;<A onclick="createNewDocumentWithRedirect('http:\u002f\u002fwww.yoursite.com\u002fsce\u002fSubSiteName\u002fListName\u002fForms\u002ftemplate.xsn', 'http:\u002f\u002fwww.yoursite.com\u002fsce\u002fSubSiteName\u002fListName', 'SharePoint.OpenXmlDocuments.2', true, 'http://www.yoursite.com/SubSiteName/_layouts/FormServer.aspx?XsnLocation=http://www.yoursite.com/SubSiteName/ListName/Forms/template.xsn&OpenIn=Browser', 0);return false;" href="#">New ListName Document</A>

Note the change - &OpenIn=Browser added in the URL above.

You can also check out this blogpost for detailed info on how createNewDocumentWithRedirect works in core.js file.

Last but not the least, also make sure that your form library is browser enabled to help the InfoPath form open in browser.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top