I'm trying to submit my form to "NewCustomer" action in "CustomerListApiController"
This is where I'm trying to route my form
Html.BeginUmbracoForm("NewCustomer", "CustomerListApi", FormMethod.Post, new { @enctype = "multipart/form-data")
I have a button of type="submit"
When you click the "Open form" button on my page an Ajax-post is triggered to the "Modal" Action in "CustomerListApiController". The method returns the requested data and a modal with the form is shown on the page.
But when I inspect the form element it says that it wants to post to "Modal" action again. Despite that I've specified "NewCustomer" in BeginUmbracoForm.
My controller
public class PatientListApiController : SurfaceController
{
[HttpPost]
public ActionResult NewCustomer(CustomerBE pCustomerBE)
{
//Do Stuff
}
[HttpPost]
public PartialViewResult Modal(int? Id)
{
//GetData and return model for rendering the form in a modal
}
}
Your controller has 2 methods, 1 for showing the form ShowForm and 1 for the business logic that is executed after the submit button is pressed HandleFormPost
All the routing information is in the following statement
Html.BeginUmbracoForm
Html.BeginUmbracoForm is only a wrapper around Razors own Html.BeginForm with some additional functionality for routing.
BeginUmbracoForm, how to route to right action
I'm trying to submit my form to "NewCustomer" action in "CustomerListApiController"
This is where I'm trying to route my form
I have a button of type="submit"
When you click the "Open form" button on my page an Ajax-post is triggered to the "Modal" Action in "CustomerListApiController". The method returns the requested data and a modal with the form is shown on the page. But when I inspect the form element it says that it wants to post to "Modal" action again. Despite that I've specified "NewCustomer" in BeginUmbracoForm.
My controller
What I'm I doing wrong?
Your controller has 2 methods, 1 for showing the form ShowForm and 1 for the business logic that is executed after the submit button is pressed HandleFormPost
All the routing information is in the following statement
Html.BeginUmbracoForm
Html.BeginUmbracoForm is only a wrapper around Razors own Html.BeginForm with some additional functionality for routing.
The above statement creates something like
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.