Sorry for the confusing title! I'll try to explain my problem a little bit better..

So the site that I'm building has a contact form (created using InfoPath 2010) on each page that the visitor can fill and their answer is saved into a SharePoint list that is residing at the root level of the site. (/Lists/Answers for example)

Now, the form works fine on the homepage because the list is at the same level but when I open a subsite I get an error that the list cannot be found.

So the main problem is that FormLocation in BrowserFormWebPart always takes the current subsite as a starting point and it looks like there's no way to make it look for the Form starting always from the root level.

<WebUI:BrowserFormWebPart runat="server" AllowEdit="True" AllowConnect="True" SubmitBehavior="KeepOpen" ConnectionID="00000000-0000-0000-0000-000000000000" Title="InfoPath Form Web Part" IsIncluded="True" Dir="Default" ExportMode="All" IsVisible="True" ShowFormRibbon="False" DefaultView="Edit item" AllowMinimize="True" ExportControlledProperties="True" ZoneID="ImportedPartZone" ID="g_18238c7b_1447_44f6_b0de_64e6d7555930" FormLocation="/Lists/Answers" FrameState="Normal" SendDataOnPostback="True" AllowHide="True" SuppressWebPartChrome="False" DetailLink="" HelpLink="" MissingAssembly="Cannot import this Web Part." PartImageSmall="" AllowRemove="True" ListFormMode="Editable" ContentTypeId="0x010082E93815C5A4B14997932C045B09BFBC" HelpMode="Modeless" FrameType="Default" AllowZoneChange="True" PartOrder="0" Description="Use this Web Part to display an InfoPath browser-enabled form." PartImageLarge="" IsIncludedFilter="" __MarkupType="vsattributemarkup" __WebPartId="{18238c7b-1447-44f6-b0de-64e6d7555930}" WebPart="true" Height="" Width=""></WebUI:BrowserFormWebPart>

Does anyone have any idea how to fix this issue?

  • I was thinking that maybe it's possible to create the Answers list in each subsite but even that doesn't seem to work. The form always returns the error "List does not exist." even though the list with the correct title exists in the subsite. – Juhani Aug 9 '11 at 23:57

My guess is that you should remove the trailing '/' of the FormLocation attribute. So make look like this: FormLocation="Lists/Answers".

  • That doesn't work. BrowserFormWebPart doesn't seem to understand the concept that lists might reside in other site levels than the one that the form is displayed in. Thanks anyways Bernd! – Juhani Aug 9 '11 at 23:53
  • One last option could be to try the relative path from your page to the list, e.g. '../Lists/Answers'. – Bernd Rickenberg Aug 10 '11 at 7:49

Two ideas:

1) Have you tried the full Url for the list in the FormLocation property?

  • or -

2) Just create a web part page at the root, drop the BrowserFormWebPart on it, and then on every page you want to let them leave comments put a link or button that loads that page in a nice 2010 dialog. You could even go as far as adding a feedback/comment button to a custom master page and then you don't have to worry about adding it to each page individually. Here's an example from a website I recently worked on...in this case it was a custom application page I was deploying as part of a feature, but the end result is the same.

<a onclick="javascript:NewItem2(event, &quot;/_layouts/padotcom/contactform.aspx&quot;);javascript:return false;" href="/_layouts/padotcom/contactform.aspx">Submit Inquiry</a>

NewItem2 is a OOB js function that displays the page in a dialog.

  • Hey, The full URL didn't work either. As for the second idea, that would work otherwise but the site is an Internet facing public site so the form has to be in the master page and the users shouldn't see any dialogs or the like. Maybe I could use that code to embed a page with the form to the master page using iFrame & JavaScript haha. Maybe not.. I'm starting to think that maybe the only way to achieve this is to ditch the idea of using InfoPath for this and instead try to create a custom web part that handles creating new list items whenever someone posts the form. – Juhani Aug 11 '11 at 3:25
  • Yep...that's what my contact form did, except it was an application page instead of a web part. Sounds like a good way to go if displaying it in a dialog is not an option for you. – Rob D'Oria Aug 11 '11 at 3:33

So I finally got the form working on all of the pages of the site.

Basically I created a new Visual Web Part and I created all the necessary fields there and also a submit button that when clicked, validates the input fields and then adds a new item to a list with the answer from the user.

Because this is a public Sharepoint 2010 site, anonymous users will fill the form so basically the web part creates the item in a temporary list and then the item is moved automatically by an event receiver to a list that only logged in users can see.

So what I learned from this: InfoPath 2010 forms only work on the subsite they are published to. If you need a form that is displayed on each page, you should create a new Visual Web Part in Visual Studio instead of using InfoPath.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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