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

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

Thanks guys!!

share|improve this question
    
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. –  Mr. J Aug 9 '11 at 23:57

3 Answers 3

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

share|improve this answer
    
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! –  Mr. J 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.

share|improve this answer
    
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. –  Mr. J 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
up vote 0 down vote accepted

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.

share|improve this answer

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.