Try our conversational search powered by Generative AI!

XForms and MVC - BeforeSubmitPostedData

Vote:
 

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
Vote:
 

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
Vote:
 

The view looks like this:

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

#64831
Jan 11, 2013 8:58
Vote:
 

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

#84508
Apr 02, 2014 17:37
Vote:
 

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
Vote:
 

I would like to also see the answer, please.

#114445
Dec 11, 2014 17:00
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.