XForms and MVC - BeforeSubmitPostedData

 

We´re using XForms on our EPiServer 7 + MVC site. On our XFormPage we´re trying to read and modify what ChannelOptions the form should use by subscribing to the BeforeSubmitPostedData event. The event fires alright, but the ChannelOptions is always None when trying to read it. Are we doing anything wrong here?

public class XFormPageController : PageController<XFormPage>
{

    public ActionResult Index(XFormPage currentPage)

    {
        XFormActionHelper.BeforeSubmitPostedData += OnBeforeSubmitPostedData;

        return View(currentPage);
    }


    private void OnBeforeSubmitPostedData(object sender, XFormDataEventArgs e)

    {
        // e.FormData.ChannelOptions is always None
    }

}

 

#64824 Jan 10, 2013 17:25
  •  

    In your view, how are you adding the XForm? I believe there's an overload to the method where you can pass in some parameters for this.

    Frederik

    #64826 Jan 10, 2013 18:39
  •  

    The view looks like this:

    @Html.DisplayFor(m => m.XForm, new { XFormParameters = new XFormParameters() { SuccessAction = "Success", FailedAction = "Failed"} })

    #64831 Jan 11, 2013 8:58
  •  

    I see this was never answered. I have the same issue.

    #84508 Apr 02, 2014 17:37
  • Frida Stafnergård
    Member since: 2008
     

    Hi,

    Any answeres on your question? Did you solve it?

    I would be grateful if you posted your solution.

    #90813 Sep 18, 2014 13:14
  •  

    I would like to also see the answer, please.

    #114445 Dec 11, 2014 17:00