AI OnAI Off
Probably pretty late reply. But anyway for reference:
I found it useful to write form action Url to the view model in controller (for instance):
var urlResolver = ServiceLocator.Current.GetInstance<UrlResolver>();
var pageUrl = urlResolver.GetVirtualPath(currentPage.ContentLink);
var actionUrl = string.Format("{0}XFormPost/", pageUrl);
actionUrl = UriSupport.AddQueryString(actionUrl, "XFormId", viewModel.Form.Id.ToString());
actionUrl = UriSupport.AddQueryString(actionUrl, "failedAction", "Failed");
actionUrl = UriSupport.AddQueryString(actionUrl, "successAction", "Success");
viewModel.ActionUrl = actionUrl;
And then write XForm using BeginXForm method:
@using (Html.BeginXForm(Model.Form, new { Action = Model.ActionUrl }))
{
Html.RenderXForm(Model.Form);
}
More info about how to host in blocks: http://blog.nansen.com/2013/03/creating-xform-block-in-episerver-7-mvc.html
There's a slightly updated version of the above mentioned blog post here: http://cjsharp.com/blog/2013/04/11/creating-a-xform-block-in-episerver-7-mvc-with-working-validation-updated/
I'm experimenting a bit with XForms, both on a page, and in a block.
So far I have managed to get the postings to work from both, by a bit of trickery, but for some reason, the default rendering of the action attribute does not include the current language branch, so all postings go to the master language version. Am I missing something? I'd rather not start writing a workaround, if there'se nothing to work around :)