Must select Show data for all pages checkbox in Edit mode to find submitted EPiServer XForms Form Data

I noticed a problem with a customer’s XForm earlier; no matter how many times I posted data, I was not able to find it through the Edit mode Form Data-tab. It was not until I marked the checkbox Show data for all pages that I got any hits.

EPiServer Form Data tab with the checkbox Show data for all pages checked

The XForm data exist in a table called tblXFormData in the EPiServer database. Checking the content of this table showed the reason for my problem; the PageGuid column was not set to any proper PageGuid, thus the data was not at all attached to my XForm page.

EPiServer table tblXFormData with faulty PageGuid entry

To fix this problem I had to change the BeforeSubmitPostedData event handler in my XForm user control. The xForm control is just an ordinary XFormControl. I have stripped away unnecessary code in the snippet below.


<XForms:XFormControl ID="xForm" runat="server" ValidationGroup="XForm" />


public partial class XForm : Core.UserControlBase
    protected override void OnInit(EventArgs e)
        xForm.BeforeSubmitPostedData += xForm_BeforeSubmitPostedData;

    private void xForm_BeforeSubmitPostedData(object sender, SaveFormDataEventArgs e)
        e.FormData.PageGuid = CurrentPage.PageGuid;

Basically, before submitting the visitor’s input to the database we manually specify the PageGuid to the one of our CurrentPage. This will make EPiServer attach the submitted data to the correct page and allow us to find it without searching all the pages.

I have seen this problem in EPiServer CMS 5 websites as well, but sadly did not have the time to investigate it back then.

One Response

  1. Johan September 4, 2012