Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
I tried the URL above but it still open the InfoPath client even though I have set the form library to browser enabled and have ensure that the InfoPath form is web-based. Any clues why it is so? –  Jack Mar 14 '12 at 5:52
    
can u try just this part in your browser -http://www.yoursite.com/SubSiteName/_layouts/FormServer.aspx?XsnLocation=http:‌​//www.yoursite.com/SubSiteName/ListName/Forms/template.xsn&OpenIn=Browser .If that works, then its some problem with the complete URL. If your form is set to open in browser, go to the library and click on new item, which should open in browser. If it does, then we need to check that URL and compare whats the difference. You can also try DefaultItemOpen=1 at the end of the url instead of Openin=browser. Good Luck. –  Deepu Nair Mar 14 '12 at 6:34
    
Thanks Deepu, it works if just using this URL - http://www.yoursite.com/SubSiteName/_layouts/FormServer.aspx?XsnLocation=http:/‌​/‌​www.yoursite.com/SubSiteName/ListName/Forms/template.xsn&OpenIn=Browser. Look like I have to debug the complete URL. –  Jack Mar 14 '12 at 7:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.