New UmbracoForms (not Contour) AJAX call

可紊 提交于 2019-12-12 02:56:16

问题


Update: The project has been started that should amend most, if not all, the problems UmbracoForms have (including AJAX calls). The discussion started on this forum thread: our.umbraco.org/forum/umbraco-7/developing-umbraco-7-packages/69933-replacing-contour-umbraco-forms-with-something-better. The website for the solution is: www.formulate.rocks and expected release date is 'early 2016' as stated on their website.

Original post:

I am trying to make an Ajax call with new UmbracoForms, but so far without success. The issue I am experiencing is described in the following OUR Umbraco forum post.

The problem is related with the modification of custom 'Form.cshtml'. Current implementation uses the following HTML helper:

@using (Html.BeginUmbracoForm<Umbraco.Forms.Web.Controllers.UmbracoFormsController>("HandleForm"))

This causes a post back to the page, which is a problem since the form on the website is being displayed in modal/overlay window.

I have tried the following two implementations:

First:

@using (Ajax.BeginForm("UmbracoForms", "HandleForm", new AjaxOptions 
                                                     {
                                                      HttpMethod = "POST",
                                                      OnSuccess = "Success()",
                                                      OnFailure = "Failure()"
                                                     }))

Second:

@using (Html.BeginForm("HandleForm", "UmbracoForms", FormMethod.Post, new { enctype = "multipart/form-data", role = "form" }))

There is additional information on the Umbraco forum page I have referenced, and also there is my comment at the bottom of the post with the described issue.

来源:https://stackoverflow.com/questions/33549096/new-umbracoforms-not-contour-ajax-call

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!